server state cleanup

This commit is contained in:
2020-04-05 21:35:42 +00:00
parent e367b4b132
commit 8443c7c5bf
15 changed files with 116 additions and 101 deletions

View File

@@ -53,8 +53,8 @@ namespace AyaNova.Api.Controllers
[HttpGet("{id}")]
public async Task<IActionResult> GetDataListView([FromRoute] long id)
{
if (serverState.IsClosed)
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
//Instantiate the business object handler
DataListViewBiz biz = DataListViewBiz.GetBiz(ct, HttpContext);
@@ -81,8 +81,8 @@ namespace AyaNova.Api.Controllers
[HttpGet("ViewList", Name = nameof(DataListViewList))]
public async Task<IActionResult> DataListViewList([FromQuery] string ListKey)
{
if (serverState.IsClosed)
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState));
@@ -106,7 +106,7 @@ namespace AyaNova.Api.Controllers
public async Task<IActionResult> PutDataListView([FromRoute] long id, [FromBody] DataListView inObj)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState));
@@ -147,7 +147,7 @@ namespace AyaNova.Api.Controllers
public async Task<IActionResult> PostDataListView([FromBody] DataListView inObj, ApiVersion apiVersion)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
//Instantiate the business object handler
DataListViewBiz biz = DataListViewBiz.GetBiz(ct, HttpContext);
@@ -168,7 +168,7 @@ namespace AyaNova.Api.Controllers
}
/// <summary>
/// <summary>
/// Duplicate DataListView
/// </summary>
/// <param name="id">Create a duplicate of this items id</param>
@@ -178,7 +178,7 @@ namespace AyaNova.Api.Controllers
public async Task<IActionResult> Duplicate([FromRoute] long id, ApiVersion apiVersion)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
//Instantiate the business object handler
DataListViewBiz biz = DataListViewBiz.GetBiz(ct, HttpContext);
@@ -212,7 +212,7 @@ namespace AyaNova.Api.Controllers
public async Task<IActionResult> DeleteDataListView([FromRoute] long id)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState));
@@ -241,8 +241,8 @@ namespace AyaNova.Api.Controllers
[HttpGet("default/{dataListKey}")]
public ActionResult GetDefaultDataListView([FromRoute] string dataListKey)
{
if (serverState.IsClosed)
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
//Instantiate the business object handler
DataListViewBiz biz = DataListViewBiz.GetBiz(ct, HttpContext);