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
{
///
/// 用户接口
///
[RoutePrefix("api/UserApi")]
[HandlerApiLogin(FilterMode.Enforce)]
[TokenAuthorize]
public class UserApiController : WebApiControllerBase
{
private UserIBLL userIBLL = new UserBLL();
///
/// 获取用户信息
///
/// 用户主键
///
[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);
}
}
///
/// 获取用户信息
///
///
[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);
}
}
}
}