OpenAuth.Net/OpenAuth.Mvc/Controllers/UserManagerController.cs

71 lines
1.6 KiB
C#
Raw Normal View History

using System;
2015-11-26 23:09:25 +08:00
using System.Linq;
2015-10-26 21:58:12 +08:00
using System.Web.Mvc;
2015-11-15 00:13:49 +08:00
using Infrastructure;
using OpenAuth.App;
2015-11-13 21:33:53 +08:00
using OpenAuth.App.ViewModel;
using OpenAuth.Mvc.Models;
2015-10-26 21:58:12 +08:00
namespace OpenAuth.Mvc.Controllers
{
2015-11-08 23:19:04 +08:00
public class UserManagerController : BaseController
2015-10-26 21:58:12 +08:00
{
2015-11-13 21:33:53 +08:00
private UserManagerApp _app;
public UserManagerController()
{
_app = AutofacExt.GetFromFac<UserManagerApp>();
2015-11-13 21:33:53 +08:00
}
2015-10-26 21:58:12 +08:00
//
// GET: /UserManager/
[Authenticate]
2015-10-26 21:58:12 +08:00
public ActionResult Index()
{
return View();
}
2015-11-13 21:33:53 +08:00
2015-11-16 23:18:51 +08:00
//添加或修改组织
2015-11-13 21:33:53 +08:00
[HttpPost]
2015-11-15 00:13:49 +08:00
public string Add(UserView view)
2015-11-13 21:33:53 +08:00
{
try
{
2015-11-15 00:13:49 +08:00
_app.AddOrUpdate(view);
2015-11-13 21:33:53 +08:00
}
catch (Exception ex)
{
2016-10-14 11:22:16 +08:00
Result.Status = false;
Result.Message = ex.Message;
2015-11-13 21:33:53 +08:00
}
2016-10-14 11:22:16 +08:00
return JsonHelper.Instance.Serialize(Result);
2015-11-13 21:33:53 +08:00
}
/// <summary>
/// 加载组织下面的所有用户
/// </summary>
2016-10-17 11:43:56 +08:00
public string Load(Guid orgId, int page = 1, int rows = 30)
2015-11-15 00:13:49 +08:00
{
2016-10-17 11:43:56 +08:00
return JsonHelper.Instance.Serialize(_app.Load(orgId, page, rows));
2015-11-15 00:13:49 +08:00
}
2016-10-15 01:27:39 +08:00
[HttpPost]
public string Delete(Guid[] ids)
2015-11-13 21:33:53 +08:00
{
try
{
2016-10-15 01:27:39 +08:00
_app.Delete(ids);
2015-11-13 21:33:53 +08:00
}
catch (Exception e)
{
2016-10-14 11:22:16 +08:00
Result.Status = false;
Result.Message = e.Message;
2015-11-13 21:33:53 +08:00
}
2016-10-14 11:22:16 +08:00
return JsonHelper.Instance.Serialize(Result);
2015-11-13 21:33:53 +08:00
}
2015-11-26 23:09:25 +08:00
2015-11-30 00:12:42 +08:00
2015-11-13 21:33:53 +08:00
}
2015-10-26 21:58:12 +08:00
}