This commit is contained in:
@@ -57,6 +57,11 @@ namespace AyaNova.Api.Controllers
|
||||
if (serverState.IsClosed)
|
||||
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
|
||||
|
||||
//Attempt to get the data list by key to see if key is valid and for the default template and valid field names
|
||||
var DataList = DataListFactory.GetAyaDataList(DataListKey);
|
||||
if (DataList == null)
|
||||
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
|
||||
//Instantiate the business object handler
|
||||
DataListTemplateBiz biz = DataListTemplateBiz.GetBiz(ct, HttpContext);
|
||||
|
||||
@@ -66,7 +71,7 @@ namespace AyaNova.Api.Controllers
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
|
||||
var o = await biz.GetAsync(DataListKey);
|
||||
var o = await biz.GetAsync(DataListKey, true, DataList);
|
||||
if (o == null)
|
||||
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
|
||||
@@ -111,10 +116,15 @@ namespace AyaNova.Api.Controllers
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
|
||||
//Attempt to get the data list by key to see if key is valid and for the default template and valid field names
|
||||
var DataList = DataListFactory.GetAyaDataList(DataListKey);
|
||||
if (DataList == null)
|
||||
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
|
||||
//Instantiate the business object handler
|
||||
DataListTemplateBiz biz = DataListTemplateBiz.GetBiz(ct, HttpContext);
|
||||
|
||||
var o = await biz.GetNoLogAsync(DataListKey);
|
||||
var o = await biz.GetAsync(DataListKey, false, DataList);
|
||||
if (o == null)
|
||||
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
|
||||
@@ -123,7 +133,7 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
try
|
||||
{
|
||||
if (!biz.Put(o, inObj))
|
||||
if (!biz.Put(o, inObj, DataList))
|
||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||
}
|
||||
catch (DbUpdateConcurrencyException)
|
||||
@@ -132,7 +142,7 @@ namespace AyaNova.Api.Controllers
|
||||
// return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
// else
|
||||
//these always exist so can only be concurrency conflict
|
||||
return StatusCode(409, new ApiErrorResponse(ApiErrorCode.CONCURRENCY_CONFLICT));
|
||||
return StatusCode(409, new ApiErrorResponse(ApiErrorCode.CONCURRENCY_CONFLICT));
|
||||
}
|
||||
return Ok(ApiOkResponse.Response(new { ConcurrencyToken = o.ConcurrencyToken }, true));
|
||||
}
|
||||
@@ -157,10 +167,15 @@ namespace AyaNova.Api.Controllers
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
|
||||
//Attempt to get the data list by key to see if key is valid
|
||||
var DataList = DataListFactory.GetAyaDataList(DataListKey);
|
||||
if (DataList == null)
|
||||
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
|
||||
//Instantiate the business object handler
|
||||
DataListTemplateBiz biz = DataListTemplateBiz.GetBiz(ct, HttpContext);
|
||||
|
||||
var o = await biz.GetNoLogAsync(DataListKey);
|
||||
var o = await biz.GetAsync(DataListKey, false, DataList);
|
||||
if (o == null)
|
||||
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user