This commit is contained in:
2020-07-26 22:05:42 -04:00
parent f2ca3419b0
commit 85d99d2615
4 changed files with 10 additions and 5 deletions

View File

@@ -12,8 +12,10 @@ namespace PartSource.Api.Controllers
[Route("[controller]")] [Route("[controller]")]
public class ErrorController : ControllerBase public class ErrorController : ControllerBase
{ {
[HttpGet]
[Route("")] [Route("")]
[AllowAnonymous] [AllowAnonymous]
public ActionResult Get() public ActionResult Get()
{ {
IExceptionHandlerPathFeature exceptionFeature = HttpContext.Features.Get<IExceptionHandlerPathFeature>(); IExceptionHandlerPathFeature exceptionFeature = HttpContext.Features.Get<IExceptionHandlerPathFeature>();

View File

@@ -7,6 +7,7 @@ using System.Threading.Tasks;
namespace PartSource.Api.Controllers namespace PartSource.Api.Controllers
{ {
[Route("[controller]")] [Route("[controller]")]
[Route("v1/[controller]")]
[ApiController] [ApiController]
public class InventoryController : BaseNexpartController public class InventoryController : BaseNexpartController
{ {
@@ -21,7 +22,7 @@ namespace PartSource.Api.Controllers
[Route("sku/{sku}/storeNumber/{storeNumber}")] [Route("sku/{sku}/storeNumber/{storeNumber}")]
public async Task<ActionResult> GetInventory(int sku, int storeNumber) public async Task<ActionResult> GetInventory(int sku, int storeNumber)
{ {
PartsAvailability inventory = _inventoryService.GetInventory(sku, storeNumber); PartsAvailability inventory = await _inventoryService.GetInventory(sku, storeNumber);
if (inventory == null) if (inventory == null)
{ {

View File

@@ -17,8 +17,8 @@ namespace PartSource.Api.Controllers
/// <summary> /// <summary>
/// This controller exists to enable legacy support for the old Nexpart-based vehicle lookup. /// This controller exists to enable legacy support for the old Nexpart-based vehicle lookup.
/// </summary> /// </summary>
[Obsolete]
[Route("vehicles")] [Route("vehicles")]
[Route("v1/vehicles")]
[ApiController] [ApiController]
public class LegacyVehiclesController : BaseNexpartController public class LegacyVehiclesController : BaseNexpartController
{ {

View File

@@ -1,9 +1,11 @@
using PartSource.Data; using Microsoft.EntityFrameworkCore;
using PartSource.Data;
using PartSource.Data.Dtos; using PartSource.Data.Dtos;
using PartSource.Data.Models; using PartSource.Data.Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks;
namespace PartSource.Services namespace PartSource.Services
{ {
@@ -27,9 +29,9 @@ namespace PartSource.Services
return _context.Parts.FirstOrDefault(p => p.Sku == sku); return _context.Parts.FirstOrDefault(p => p.Sku == sku);
} }
public PartsAvailability GetInventory(int sku, int storeNumber) public async Task<PartsAvailability> 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<Fitment> GetFitments(FitmentSearchDto fitmentSearchDto) public IList<Fitment> GetFitments(FitmentSearchDto fitmentSearchDto)