This commit is contained in:
2021-02-25 22:43:16 +00:00
parent e48b96f60a
commit 8c31bd19a0
2 changed files with 35 additions and 7 deletions

View File

@@ -265,7 +265,7 @@ namespace AyaNova.Api.Controllers
///<param name="id">PartId</param>
/// <returns></returns>
[HttpPut("part-cost/{id}")]
public async Task<IActionResult> PutPartSerials([FromRoute] long id, [FromBody] decimal newCost)
public async Task<IActionResult> PutPartCost([FromRoute] long id, [FromBody] decimal newCost)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
@@ -274,18 +274,15 @@ namespace AyaNova.Api.Controllers
PartBiz biz = PartBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasModifyRole(HttpContext.Items, biz.BizType))
return StatusCode(403, new ApiNotAuthorizedResponse());
var o = await biz.PutPartCostAsync(id, newCost);
if (o == null)
if (await biz.PutPartCostAsync(id, newCost) == false)
{
if (biz.Errors.Exists(z => z.Code == ApiErrorCode.CONCURRENCY_CONFLICT))
return StatusCode(409, new ApiErrorResponse(biz.Errors));
else
return BadRequest(new ApiErrorResponse(biz.Errors));
}
return Ok(ApiOkResponse.Response(o));
return NoContent();
}