2018-08-26 15:44:19 +08:00
|
|
|
|
using Bootstrap.DataAccess;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2018-09-13 16:34:32 +08:00
|
|
|
|
using System.Collections.Generic;
|
2018-08-26 15:44:19 +08:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace Bootstrap.Admin.Controllers
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Route("api/[controller]")]
|
|
|
|
|
public class NewController : Controller
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2018-09-13 16:34:32 +08:00
|
|
|
|
/// 通知管理页面获得所有新用户方法调用
|
2018-08-26 15:44:19 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
2018-09-13 16:34:32 +08:00
|
|
|
|
public IEnumerable<object> Get()
|
2018-08-26 15:44:19 +08:00
|
|
|
|
{
|
2018-09-13 16:34:32 +08:00
|
|
|
|
return UserHelper.RetrieveNewUsers().Select(user => new
|
|
|
|
|
{
|
|
|
|
|
user.Id,
|
|
|
|
|
user.UserName,
|
|
|
|
|
user.DisplayName,
|
|
|
|
|
user.Description,
|
|
|
|
|
user.RegisterTime
|
|
|
|
|
});
|
2018-08-26 15:44:19 +08:00
|
|
|
|
}
|
2018-09-07 15:53:16 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新用户授权/拒绝接口
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPut("{id}")]
|
|
|
|
|
public bool Put([FromBody]User value)
|
2018-08-26 17:14:39 +08:00
|
|
|
|
{
|
|
|
|
|
var ret = false;
|
2018-09-07 15:53:16 +08:00
|
|
|
|
if (value.UserStatus == UserStates.ApproveUser)
|
|
|
|
|
{
|
|
|
|
|
ret = UserHelper.ApproveUser(value.Id, User.Identity.Name);
|
|
|
|
|
}
|
|
|
|
|
else if (value.UserStatus == UserStates.RejectUser)
|
|
|
|
|
{
|
|
|
|
|
ret = UserHelper.RejectUser(value.Id, User.Identity.Name);
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
2018-08-26 17:14:39 +08:00
|
|
|
|
}
|
2018-08-26 15:44:19 +08:00
|
|
|
|
}
|
2018-08-01 17:30:29 +08:00
|
|
|
|
}
|