This commit is contained in:
2020-03-17 15:53:39 +00:00
parent 556ff25ab6
commit d1763bbba5
2 changed files with 42 additions and 25 deletions

View File

@@ -89,7 +89,7 @@ namespace AyaNova.Api.Controllers
var o = await biz.GetPickListAsync(PickList, query, inactive);
if (o == null)
return BadRequest(new ApiErrorResponse(biz.Errors));
else
@@ -97,6 +97,36 @@ namespace AyaNova.Api.Controllers
}
/// <summary>
/// Get PickListTemplate
/// </summary>
/// <param name="ayaType"></param>
/// <returns>The current effective template, either a customized one or the default</returns>
[HttpGet("Template/{ayatype}")]
public async Task<IActionResult> GetDataListView([FromRoute] AyaType ayaType)
{
if (serverState.IsClosed)
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
//Instantiate the business object handler
PickListBiz biz = PickListBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
return StatusCode(403, new ApiNotAuthorizedResponse());
if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState));
var o = await biz.GetAsync(ayaType);
if (o == null)
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
return Ok(ApiOkResponse.Response(o, !Authorized.HasModifyRole(HttpContext.Items, biz.BizType)));
}
/// <summary>
/// List of all PickList templates
/// </summary>