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

77 lines
1.9 KiB
C#
Raw Normal View History

2016-01-05 10:03:35 +08:00
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;
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/
public ActionResult Index()
{
return View();
}
2015-11-13 21:33:53 +08:00
2015-11-15 00:13:49 +08:00
public ActionResult Add(int id = 0)
2015-11-13 21:33:53 +08:00
{
2015-11-15 00:13:49 +08:00
return View(_app.Find(id));
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)
{
BjuiResponse.statusCode = "300";
BjuiResponse.message = ex.Message;
}
return JsonHelper.Instance.Serialize(BjuiResponse);
}
/// <summary>
/// 加载组织下面的所有用户
/// </summary>
2015-11-15 23:00:08 +08:00
public string Load(int orgId, int pageCurrent = 1, int pageSize = 30)
2015-11-15 00:13:49 +08:00
{
2015-11-15 23:00:08 +08:00
return JsonHelper.Instance.Serialize(_app.Load(orgId, pageCurrent, pageSize));
2015-11-15 00:13:49 +08:00
}
2015-12-05 21:24:01 +08:00
public string Delete(int Id)
2015-11-13 21:33:53 +08:00
{
try
{
2015-12-05 21:24:01 +08:00
_app.Delete(Id);
//foreach (var obj in Id.Split(','))
//{
// _app.Delete(int.Parse(obj));
//}
2015-11-13 21:33:53 +08:00
}
catch (Exception e)
{
BjuiResponse.statusCode = "300";
BjuiResponse.message = e.Message;
}
return JsonHelper.Instance.Serialize(BjuiResponse);
}
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
}