This commit is contained in:
@@ -231,14 +231,14 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
try
|
||||
{
|
||||
if (!biz.PutLocaleItemDisplayTextAsync(oFromDb, inObj, oDbParent))
|
||||
if (!await biz.PutLocaleItemDisplayTextAsync(oFromDb, inObj, oDbParent))
|
||||
{
|
||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||
}
|
||||
}
|
||||
catch (DbUpdateConcurrencyException)
|
||||
{
|
||||
if (!biz.LocaleItemExistsAsync(inObj.Id))
|
||||
if (!await biz.LocaleItemExistsAsync(inObj.Id))
|
||||
{
|
||||
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
}
|
||||
@@ -293,7 +293,7 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
try
|
||||
{
|
||||
if (!biz.PutLocaleNameAsync(oFromDb, inObj))
|
||||
if (!await biz.PutLocaleNameAsync(oFromDb, inObj))
|
||||
{
|
||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||
}
|
||||
@@ -301,7 +301,7 @@ namespace AyaNova.Api.Controllers
|
||||
}
|
||||
catch (DbUpdateConcurrencyException)
|
||||
{
|
||||
if (!biz.LocaleExistsAsync(inObj.Id))
|
||||
if (!await biz.LocaleExistsAsync(inObj.Id))
|
||||
{
|
||||
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
}
|
||||
@@ -340,7 +340,7 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
//Fetch locale and it's children
|
||||
//(fetch here so can return proper REST responses on failing basic validity)
|
||||
var dbObj = ct.Locale.Include(x => x.LocaleItems).SingleOrDefault(m => m.Id == id);
|
||||
var dbObj = await ct.Locale.Include(x => x.LocaleItems).SingleOrDefaultAsync(m => m.Id == id);
|
||||
if (dbObj == null)
|
||||
{
|
||||
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
@@ -353,21 +353,12 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
|
||||
//Instantiate the business object handler
|
||||
//LocaleBiz biz = new LocaleBiz(ct, UserIdFromContext.Id(HttpContext.Items), UserRolesFromContext.Roles(HttpContext.Items));
|
||||
LocaleBiz biz = LocaleBiz.GetBiz(ct, HttpContext);
|
||||
if (!biz.DeleteAsync(dbObj))
|
||||
if (!await biz.DeleteAsync(dbObj))
|
||||
{
|
||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||
}
|
||||
//Log
|
||||
EventLogProcessor.DeleteObjectLogAsync(biz.UserId, AyaType.Locale, dbObj.Id, dbObj.Name, ct);
|
||||
await ct.SaveChangesAsync();
|
||||
|
||||
//Delete children / attached objects
|
||||
// biz.DeleteChildren(dbObj);
|
||||
|
||||
|
||||
|
||||
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user