mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-11-09 02:44:44 +08:00
优化代码结构,完成分类处理
This commit is contained in:
@@ -13,7 +13,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
|
||||
public CategoryManagerController()
|
||||
{
|
||||
_app = (CategoryManagerApp)DependencyResolver.Current.GetService(typeof(CategoryManagerApp));
|
||||
_app = AutofacExt.GetFromFac<CategoryManagerApp>();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -23,6 +23,28 @@ namespace OpenAuth.Mvc.Controllers
|
||||
return View();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载组织下面的所有用户
|
||||
/// </summary>
|
||||
public string Load(int orgId, int pageCurrent = 1, int pageSize = 30)
|
||||
{
|
||||
return JsonHelper.Instance.Serialize(_app.Load(orgId, pageCurrent, pageSize));
|
||||
}
|
||||
|
||||
public string LoadForTree()
|
||||
{
|
||||
var models = _app.LoadAll();
|
||||
//添加根节点
|
||||
models.Add(new Category
|
||||
{
|
||||
Id = 0,
|
||||
ParentId = -1,
|
||||
Name = "根结点",
|
||||
CascadeId = "0"
|
||||
});
|
||||
return JsonHelper.Instance.Serialize(models);
|
||||
}
|
||||
|
||||
public ActionResult Add(int id = 0)
|
||||
{
|
||||
return View(_app.Find(id));
|
||||
@@ -45,14 +67,6 @@ namespace OpenAuth.Mvc.Controllers
|
||||
return JsonHelper.Instance.Serialize(BjuiResponse);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载组织下面的所有用户
|
||||
/// </summary>
|
||||
public string Load(int orgId, int pageCurrent = 1, int pageSize = 30)
|
||||
{
|
||||
return JsonHelper.Instance.Serialize(_app.Load(orgId, pageCurrent, pageSize));
|
||||
}
|
||||
|
||||
public string Delete(int Id)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -11,8 +11,8 @@ namespace OpenAuth.Mvc.Controllers
|
||||
private ModuleManagerApp _app;
|
||||
|
||||
public HomeController()
|
||||
{
|
||||
_app = (ModuleManagerApp)DependencyResolver.Current.GetService(typeof(ModuleManagerApp));
|
||||
{
|
||||
_app = AutofacExt.GetFromFac<ModuleManagerApp>();
|
||||
}
|
||||
|
||||
public string GetModules(int parentId = 0)
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
|
||||
public LoginController()
|
||||
{
|
||||
_app = (LoginApp)DependencyResolver.Current.GetService(typeof(LoginApp));
|
||||
_app = AutofacExt.GetFromFac<LoginApp>();
|
||||
}
|
||||
// GET: Login
|
||||
public ActionResult Index()
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
|
||||
public ModuleElementManagerController()
|
||||
{
|
||||
_app = (ModuleElementManagerApp) DependencyResolver.Current.GetService(typeof (ModuleElementManagerApp));
|
||||
_app = AutofacExt.GetFromFac<ModuleElementManagerApp>();
|
||||
}
|
||||
|
||||
public ActionResult Index(int id = 0)
|
||||
@@ -46,9 +46,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
var newbtn = new ModuleElement();
|
||||
button.CopyTo(newbtn);
|
||||
_app.AddOrUpdate(newbtn);
|
||||
_app.AddOrUpdate(button);
|
||||
}
|
||||
catch (DbEntityValidationException e)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
|
||||
public ModuleManagerController()
|
||||
{
|
||||
_app = (ModuleManagerApp)DependencyResolver.Current.GetService(typeof(ModuleManagerApp));
|
||||
_app = AutofacExt.GetFromFac<ModuleManagerApp>();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
|
||||
public OrgManagerController()
|
||||
{
|
||||
_orgApp = (OrgManagerApp)DependencyResolver.Current.GetService(typeof(OrgManagerApp));
|
||||
_orgApp = AutofacExt.GetFromFac<OrgManagerApp>();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
|
||||
public RoleManagerController()
|
||||
{
|
||||
_app = (RoleManagerApp)DependencyResolver.Current.GetService(typeof(RoleManagerApp));
|
||||
_app = AutofacExt.GetFromFac<RoleManagerApp>();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace OpenAuth.Mvc.Controllers
|
||||
|
||||
public UserManagerController()
|
||||
{
|
||||
_app = (UserManagerApp)DependencyResolver.Current.GetService(typeof(UserManagerApp));
|
||||
_app = AutofacExt.GetFromFac<UserManagerApp>();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user