-
Notifications
You must be signed in to change notification settings - Fork 26
/
XpUserController.cs
65 lines (56 loc) · 1.61 KB
/
XpUserController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using Base.Models;
using Base.Services;
using BaseApi.Controllers;
using DbAdm.Attributes;
using DbAdm.Services;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace DbAdm.Controllers
{
[MyProgAuth]
public class XpUserController : BaseCtrl
{
public async Task<ActionResult> Read()
{
//for read view
ViewBag.Depts = await _XpCode.DeptsA();
//for edit view
ViewBag.Roles = await _XpCode.RolesA();
return View();
}
[HttpPost]
public async Task<ContentResult> GetPage(DtDto dt)
{
return JsonToCnt(await new XpUserRead().GetPageA(Ctrl, dt));
}
private XpUserEdit EditService()
{
return new XpUserEdit(Ctrl);
}
[HttpPost]
public async Task<JsonResult> Create(string json)
{
return Json(await EditService().CreateA(_Str.ToJson(json)!));
}
[HttpPost]
public async Task<ContentResult> GetUpdJson(string key)
{
return JsonToCnt(await EditService().GetUpdJsonA(key));
}
[HttpPost]
public async Task<JsonResult> Update(string key, string json)
{
return Json(await EditService().UpdateA(key, _Str.ToJson(json)!));
}
[HttpPost]
public async Task<JsonResult> Delete(string key)
{
return Json(await EditService().DeleteA(key));
}
[HttpPost]
public async Task<ContentResult> GetViewJson(string key)
{
return JsonToCnt(await EditService().GetViewJsonA(key));
}
}//class
}