diff --git a/PartSource.Api/Controllers/ErrorController.cs b/PartSource.Api/Controllers/ErrorController.cs index 4773f30..dca9e39 100644 --- a/PartSource.Api/Controllers/ErrorController.cs +++ b/PartSource.Api/Controllers/ErrorController.cs @@ -12,8 +12,10 @@ namespace PartSource.Api.Controllers [Route("[controller]")] public class ErrorController : ControllerBase { + [HttpGet] [Route("")] [AllowAnonymous] + public ActionResult Get() { IExceptionHandlerPathFeature exceptionFeature = HttpContext.Features.Get(); diff --git a/PartSource.Api/Controllers/InventoryController.cs b/PartSource.Api/Controllers/InventoryController.cs index dd2847a..ef7fc59 100644 --- a/PartSource.Api/Controllers/InventoryController.cs +++ b/PartSource.Api/Controllers/InventoryController.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; namespace PartSource.Api.Controllers { [Route("[controller]")] + [Route("v1/[controller]")] [ApiController] public class InventoryController : BaseNexpartController { @@ -21,7 +22,7 @@ namespace PartSource.Api.Controllers [Route("sku/{sku}/storeNumber/{storeNumber}")] public async Task GetInventory(int sku, int storeNumber) { - PartsAvailability inventory = _inventoryService.GetInventory(sku, storeNumber); + PartsAvailability inventory = await _inventoryService.GetInventory(sku, storeNumber); if (inventory == null) { diff --git a/PartSource.Api/Controllers/LegacyVehiclesController.cs b/PartSource.Api/Controllers/LegacyVehiclesController.cs index 6bbfd28..b90fe43 100644 --- a/PartSource.Api/Controllers/LegacyVehiclesController.cs +++ b/PartSource.Api/Controllers/LegacyVehiclesController.cs @@ -17,8 +17,8 @@ namespace PartSource.Api.Controllers /// /// This controller exists to enable legacy support for the old Nexpart-based vehicle lookup. /// - [Obsolete] [Route("vehicles")] + [Route("v1/vehicles")] [ApiController] public class LegacyVehiclesController : BaseNexpartController { diff --git a/PartSource.Services/PartService.cs b/PartSource.Services/PartService.cs index 0f549bb..6c5335c 100644 --- a/PartSource.Services/PartService.cs +++ b/PartSource.Services/PartService.cs @@ -1,9 +1,11 @@ -using PartSource.Data; +using Microsoft.EntityFrameworkCore; +using PartSource.Data; using PartSource.Data.Dtos; using PartSource.Data.Models; using System; using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; namespace PartSource.Services { @@ -27,9 +29,9 @@ namespace PartSource.Services return _context.Parts.FirstOrDefault(p => p.Sku == sku); } - public PartsAvailability GetInventory(int sku, int storeNumber) + public async Task GetInventory(int sku, int storeNumber) { - return _context.PartAvailabilities.FirstOrDefault(s => s.Store == storeNumber && s.SKU == sku); + return await _context.PartAvailabilities.FirstOrDefaultAsync(s => s.Store == storeNumber && s.SKU == sku); } public IList GetFitments(FitmentSearchDto fitmentSearchDto)