mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-20 02:29:24 +08:00
添加Category
This commit is contained in:
73
OpenAuth.Mvc/Controllers/CategoryManagerController.cs
Normal file
73
OpenAuth.Mvc/Controllers/CategoryManagerController.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
|
||||
using System;
|
||||
using System.Web.Mvc;
|
||||
using Infrastructure;
|
||||
using OpenAuth.App;
|
||||
using OpenAuth.Domain;
|
||||
|
||||
namespace OpenAuth.Mvc.Controllers
|
||||
{
|
||||
public class CategoryManagerController : BaseController
|
||||
{
|
||||
private CategoryManagerApp _app;
|
||||
|
||||
public CategoryManagerController()
|
||||
{
|
||||
_app = (CategoryManagerApp)DependencyResolver.Current.GetService(typeof(CategoryManagerApp));
|
||||
}
|
||||
|
||||
//
|
||||
// GET: /UserManager/
|
||||
public ActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult Add(int id = 0)
|
||||
{
|
||||
return View(_app.Find(id));
|
||||
}
|
||||
|
||||
//添加或修改Category
|
||||
[HttpPost]
|
||||
public string Add(Category model)
|
||||
{
|
||||
try
|
||||
{
|
||||
_app.AddOrUpdate(model);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
BjuiResponse.statusCode = "300";
|
||||
BjuiResponse.message = ex.Message;
|
||||
}
|
||||
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
|
||||
{
|
||||
_app.Delete(Id);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
BjuiResponse.statusCode = "300";
|
||||
BjuiResponse.message = e.Message;
|
||||
}
|
||||
|
||||
return JsonHelper.Instance.Serialize(BjuiResponse);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user