59 lines
1.5 KiB
C#
59 lines
1.5 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Web.Http;
|
|
using System.Web.Http.Description;
|
|
using Learun.Application.Organization;
|
|
using Learun.Util;
|
|
|
|
namespace Learun.Application.Web.AppApi
|
|
{
|
|
/// <summary>
|
|
/// 用户接口
|
|
/// </summary>
|
|
[RoutePrefix("api/UserApi")]
|
|
[HandlerApiLogin(FilterMode.Enforce)]
|
|
[TokenAuthorize]
|
|
public class UserApiController : WebApiControllerBase
|
|
{
|
|
private UserIBLL userIBLL = new UserBLL();
|
|
|
|
/// <summary>
|
|
/// 获取用户信息
|
|
/// </summary>
|
|
/// <param name="userId">用户主键</param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
[ResponseType(typeof(UserEntity))]
|
|
public IHttpActionResult GetUserEntity(string userId)
|
|
{
|
|
try
|
|
{
|
|
var data = userIBLL.GetEntityByUserId(userId);
|
|
return Success(data);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return Fail(ex.Message);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取用户信息
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public IHttpActionResult GetList()
|
|
{
|
|
try
|
|
{
|
|
var data = userIBLL.GetAllList();
|
|
data = data.Where(x => !string.IsNullOrEmpty(x.F_CompanyId)).ToList();
|
|
return Success(data);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return Fail(ex.Message);
|
|
}
|
|
}
|
|
}
|
|
} |