This commit is contained in:
@@ -37,7 +37,7 @@ namespace AyaNova.Api.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create FormUserOptions
|
||||
/// Create or Replace FormUserOptions
|
||||
/// </summary>
|
||||
/// <param name="newObject"></param>
|
||||
/// <param name="apiVersion">From route path</param>
|
||||
@@ -52,11 +52,11 @@ namespace AyaNova.Api.Controllers
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
FormUserOptions o = await biz.CreateAsync(newObject);
|
||||
FormUserOptions o = await biz.UpsertAsync(newObject);
|
||||
if (o == null)
|
||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||
else
|
||||
return CreatedAtAction(nameof(FormUserOptionsController.GetFormUserOptions), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||
return CreatedAtAction(nameof(FormUserOptionsController.GetFormUserOptions), new { formKey = o.FormKey, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||
}
|
||||
|
||||
|
||||
@@ -80,31 +80,31 @@ namespace AyaNova.Api.Controllers
|
||||
return Ok(ApiOkResponse.Response(o));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update FormUserOptions
|
||||
/// </summary>
|
||||
/// <param name="updatedObject"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
public async Task<IActionResult> PutFormUserOptions([FromBody] FormUserOptions updatedObject)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
FormUserOptionsBiz biz = FormUserOptionsBiz.GetBiz(ct, HttpContext);
|
||||
if (!Authorized.HasModifyRole(HttpContext.Items, biz.BizType))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
var o = await biz.PutAsync(updatedObject);
|
||||
if (o == null)
|
||||
{
|
||||
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(new { Concurrency = o.Concurrency })); ;
|
||||
}
|
||||
// /// <summary>
|
||||
// /// Update FormUserOptions
|
||||
// /// </summary>
|
||||
// /// <param name="updatedObject"></param>
|
||||
// /// <returns></returns>
|
||||
// [HttpPut]
|
||||
// public async Task<IActionResult> PutFormUserOptions([FromBody] FormUserOptions updatedObject)
|
||||
// {
|
||||
// if (!serverState.IsOpen)
|
||||
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
// if (!ModelState.IsValid)
|
||||
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||
// FormUserOptionsBiz biz = FormUserOptionsBiz.GetBiz(ct, HttpContext);
|
||||
// if (!Authorized.HasModifyRole(HttpContext.Items, biz.BizType))
|
||||
// return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
// var o = await biz.PutAsync(updatedObject);
|
||||
// if (o == null)
|
||||
// {
|
||||
// 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(new { Concurrency = o.Concurrency })); ;
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Delete FormUserOptions
|
||||
|
||||
Reference in New Issue
Block a user