This commit is contained in:
2020-05-21 23:58:57 +00:00
parent 4de095ca4e
commit 9d3986224c
5 changed files with 29 additions and 41 deletions

View File

@@ -67,10 +67,10 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// PUT Global biz settings
/// </summary>
/// <param name="global"></param>
/// <returns>nothing</returns>
/// <param name="updatedObject"></param>
/// <returns>New concurrency token</returns>
[HttpPut]
public async Task<IActionResult> ReplaceGlobalBizSettings([FromBody] GlobalBizSettings global)
public async Task<IActionResult> ReplaceGlobalBizSettings([FromBody] GlobalBizSettings updatedObject)
{
if (serverState.IsClosed)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
@@ -84,16 +84,10 @@ namespace AyaNova.Api.Controllers
if (!Authorized.HasModifyRole(HttpContext.Items, biz.BizType))
return StatusCode(403, new ApiNotAuthorizedResponse());
try
{
if (!await biz.ReplaceAsync(global))
return BadRequest(new ApiErrorResponse(biz.Errors));
}
catch (DbUpdateConcurrencyException)
{
return StatusCode(409, new ApiErrorResponse(ApiErrorCode.CONCURRENCY_CONFLICT));
}
return NoContent();
var o = await biz.PutAsync(updatedObject);//In future may need to return entire object, for now just concurrency token
if (o == null)
return StatusCode(409, new ApiErrorResponse(biz.Errors));
return Ok(ApiOkResponse.Response(new { Concurrency = o.Concurrency }));
}
/// <summary>

View File

@@ -67,28 +67,22 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// PUT Global ops backup settings
/// </summary>
/// <param name="global"></param>
/// <returns>nothing</returns>
/// <param name="updatedObject"></param>
/// <returns>New concurrency token</returns>
[HttpPut]
public async Task<IActionResult> ReplaceGlobalOpsBackupSettings([FromBody] GlobalOpsBackupSettings global)
public async Task<IActionResult> ReplaceGlobalOpsBackupSettings([FromBody] GlobalOpsBackupSettings updatedObject)
{
if (serverState.IsClosed)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState));
GlobalOpsBackupSettingsBiz biz = GlobalOpsBackupSettingsBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasModifyRole(HttpContext.Items, biz.BizType))
if (!Authorized.HasModifyRole(HttpContext.Items, biz.BizType))
return StatusCode(403, new ApiNotAuthorizedResponse());
try
{
if (!await biz.ReplaceAsync(global))
return BadRequest(new ApiErrorResponse(biz.Errors));
}
catch (DbUpdateConcurrencyException)
{
return StatusCode(409, new ApiErrorResponse(ApiErrorCode.CONCURRENCY_CONFLICT));
}
return NoContent();
var o = await biz.PutAsync(updatedObject);//In future may need to return entire object, for now just concurrency token
if (o == null)
return StatusCode(409, new ApiErrorResponse(biz.Errors));
return Ok(ApiOkResponse.Response(new { Concurrency = o.Concurrency }));
}
// /// <summary>

View File

@@ -133,7 +133,7 @@ namespace AyaNova.Api.Controllers
else
return BadRequest(new ApiErrorResponse(biz.Errors));
}
return Ok(ApiOkResponse.Response(new { Concurrency = o.Concurrency })); ;
return Ok(ApiOkResponse.Response(new { Concurrency = o.Concurrency }));
}
/// <summary>