mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-07-16 07:59:54 +08:00
[try]字典管理调整为异步
This commit is contained in:
parent
0392a1ff30
commit
09c47a7a07
@ -60,14 +60,14 @@ namespace OpenAuth.App
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Add(AddOrUpdateCategoryReq req)
|
public async Task Add(AddOrUpdateCategoryReq req)
|
||||||
{
|
{
|
||||||
var obj = req.MapTo<Category>();
|
var obj = req.MapTo<Category>();
|
||||||
obj.CreateTime = DateTime.Now;
|
obj.CreateTime = DateTime.Now;
|
||||||
var user = _auth.GetCurrentUser().User;
|
var user = _auth.GetCurrentUser().User;
|
||||||
obj.CreateUserId = user.Id;
|
obj.CreateUserId = user.Id;
|
||||||
obj.CreateUserName = user.Name;
|
obj.CreateUserName = user.Name;
|
||||||
Repository.Add(obj);
|
await Repository.AddAsync(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(AddOrUpdateCategoryReq obj)
|
public void Update(AddOrUpdateCategoryReq obj)
|
||||||
|
@ -51,12 +51,12 @@ namespace OpenAuth.Mvc.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public string Add(AddOrUpdateCategoryReq obj)
|
public async Task<string> Add(AddOrUpdateCategoryReq obj)
|
||||||
{
|
{
|
||||||
Response resp = new Response();
|
Response resp = new Response();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_app.Add(obj);
|
await _app.Add(obj);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -46,13 +46,12 @@ namespace OpenAuth.WebApi.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public Response Add([FromBody] AddOrUpdateCategoryReq obj)
|
public async Task<Response> Add([FromBody] AddOrUpdateCategoryReq obj)
|
||||||
{
|
{
|
||||||
var result = new Response();
|
var result = new Response();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_app.Add(obj);
|
await _app.Add(obj);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user