2015-11-15 00:13:49 +08:00
|
|
|
|
using System;
|
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 = (UserManagerApp)DependencyResolver.Current.GetService(typeof(UserManagerApp));
|
|
|
|
|
}
|
|
|
|
|
|
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-11-13 21:33:53 +08:00
|
|
|
|
public string Delete(string Id)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
foreach (var obj in Id.Split(','))
|
|
|
|
|
{
|
|
|
|
|
_app.Delete(int.Parse(obj));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
BjuiResponse.statusCode = "300";
|
|
|
|
|
BjuiResponse.message = e.Message;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return JsonHelper.Instance.Serialize(BjuiResponse);
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-10-26 21:58:12 +08:00
|
|
|
|
}
|