This commit is contained in:
2021-04-30 13:37:32 +00:00
parent 1f9891eb0d
commit 581ea5edc3

View File

@@ -4,6 +4,8 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Routing;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Logging;
using Microsoft.EntityFrameworkCore;
using System.Linq;
using AyaNova.Models;
using AyaNova.Api.ControllerHelpers;
using AyaNova.Biz;
@@ -125,7 +127,7 @@ namespace AyaNova.Api.Controllers
else
return BadRequest(new ApiErrorResponse(biz.Errors));
}
return Ok(ApiOkResponse.Response(new { Concurrency = o.Concurrency }));;
return Ok(ApiOkResponse.Response(new { Concurrency = o.Concurrency })); ;
}
/// <summary>
@@ -149,7 +151,24 @@ namespace AyaNova.Api.Controllers
}
/// <summary>
/// Get any popup / alert notes for this customer
/// </summary>
/// <param name="id"></param>
/// <returns>Notes or no content</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));
if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.Customer))
return StatusCode(403, new ApiNotAuthorizedResponse());
if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState));
return Ok(ApiOkResponse.Response(await ct.Customer.AsNoTracking().Where(x => x.Id == id).Select(x => x.PopUpNotes).FirstOrDefaultAsync()));
}
//------------