This commit is contained in:
2021-04-30 13:39:59 +00:00
parent 581ea5edc3
commit 2b4da424e3
2 changed files with 23 additions and 8 deletions

View File

@@ -152,21 +152,19 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get any popup / alert notes for this customer
/// Get Alert notes for this customer
/// </summary>
/// <param name="id"></param>
/// <returns>Notes or no content</returns>
/// <returns>Alert notes or null</returns>
[HttpGet("alert/{id}")]
public async Task<IActionResult> GetCustomerAlert([FromRoute] long id)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.Customer))
return StatusCode(403, new ApiNotAuthorizedResponse());
if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState));
return BadRequest(new ApiErrorResponse(ModelState));
return Ok(ApiOkResponse.Response(await ct.Customer.AsNoTracking().Where(x => x.Id == id).Select(x => x.PopUpNotes).FirstOrDefaultAsync()));
}