mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-04-05 17:38:01 +08:00
71 lines
1.6 KiB
C#
71 lines
1.6 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
using Infrastructure;
|
|
using OpenAuth.App;
|
|
using OpenAuth.App.ViewModel;
|
|
using OpenAuth.Mvc.Models;
|
|
|
|
namespace OpenAuth.Mvc.Controllers
|
|
{
|
|
public class UserManagerController : BaseController
|
|
{
|
|
private UserManagerApp _app;
|
|
|
|
public UserManagerController()
|
|
{
|
|
_app = AutofacExt.GetFromFac<UserManagerApp>();
|
|
}
|
|
|
|
//
|
|
// GET: /UserManager/
|
|
[Authenticate]
|
|
public ActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
//添加或修改组织
|
|
[HttpPost]
|
|
public string Add(UserView view)
|
|
{
|
|
try
|
|
{
|
|
_app.AddOrUpdate(view);
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Result.Status = false;
|
|
Result.Message = ex.Message;
|
|
}
|
|
return JsonHelper.Instance.Serialize(Result);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 加载组织下面的所有用户
|
|
/// </summary>
|
|
public string Load(Guid orgId, int page = 1, int rows = 30)
|
|
{
|
|
return JsonHelper.Instance.Serialize(_app.Load(orgId, page, rows));
|
|
}
|
|
|
|
[HttpPost]
|
|
public string Delete(Guid[] ids)
|
|
{
|
|
try
|
|
{
|
|
_app.Delete(ids);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Result.Status = false;
|
|
Result.Message = e.Message;
|
|
}
|
|
|
|
return JsonHelper.Instance.Serialize(Result);
|
|
}
|
|
|
|
|
|
}
|
|
} |