From 2b4da424e3573197e2cca5f8906d8e5fe91833f4 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 30 Apr 2021 13:39:59 +0000 Subject: [PATCH] --- .../AyaNova/Controllers/CustomerController.cs | 10 ++++----- .../AyaNova/Controllers/VendorController.cs | 21 +++++++++++++++++-- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/server/AyaNova/Controllers/CustomerController.cs b/server/AyaNova/Controllers/CustomerController.cs index 9b3a1198..8236c32f 100644 --- a/server/AyaNova/Controllers/CustomerController.cs +++ b/server/AyaNova/Controllers/CustomerController.cs @@ -152,21 +152,19 @@ namespace AyaNova.Api.Controllers /// - /// Get any popup / alert notes for this customer + /// Get Alert notes for this customer /// /// - /// Notes or no content + /// Alert notes or null [HttpGet("alert/{id}")] public async Task 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())); } diff --git a/server/AyaNova/Controllers/VendorController.cs b/server/AyaNova/Controllers/VendorController.cs index c904e648..c7cfcfe6 100644 --- a/server/AyaNova/Controllers/VendorController.cs +++ b/server/AyaNova/Controllers/VendorController.cs @@ -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 })); ; } /// @@ -149,7 +151,22 @@ namespace AyaNova.Api.Controllers } - + /// + /// Get alert notes for this vendor + /// + /// + /// Alert notes or null + [HttpGet("alert/{id}")] + public async Task GetVendorAlert([FromRoute] long id) + { + if (!serverState.IsOpen) + return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.Vendor)) + return StatusCode(403, new ApiNotAuthorizedResponse()); + if (!ModelState.IsValid) + return BadRequest(new ApiErrorResponse(ModelState)); + return Ok(ApiOkResponse.Response(await ct.Vendor.AsNoTracking().Where(x => x.Id == id).Select(x => x.PopUpNotes).FirstOrDefaultAsync())); + } //------------