This commit is contained in:
2021-02-18 20:30:49 +00:00
parent 8786dd22df
commit bc0c255ee3
5 changed files with 74 additions and 5 deletions

View File

@@ -84,6 +84,32 @@ namespace AyaNova.Api.Controllers
return Ok(ApiOkResponse.Response(o));
}
/// <summary>
/// Get a single item's name display in PickList templated format
/// </summary>
/// <param name="pickListSingleParams"></param>
/// <returns>One display string or an empty string if not found or invalid</returns>
[HttpPost("single")]
public async Task<IActionResult> PostSingle([FromBody] PickListSingleOptions pickListSingleParams)
{
if (serverState.IsClosed)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState));
if (!Authorized.HasSelectRole(HttpContext.Items, pickListSingleParams.AyaType))
return StatusCode(403, new ApiNotAuthorizedResponse());
//Instantiate the business object handler
PickListBiz biz = PickListBiz.GetBiz(ct, HttpContext);
var o = await biz.GetTemplatedNameAsync(pickListSingleParams.AyaType, pickListSingleParams.Id, pickListSingleParams.ListVariant, log);
if (o == null)
return BadRequest(new ApiErrorResponse(biz.Errors));
else
return Ok(ApiOkResponse.Response(o));
}
/// <summary>