Initial commit

This commit is contained in:
2020-04-12 20:52:03 -04:00
parent e750d2848a
commit 01e7627293
249 changed files with 9733 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
using PartSource.Entities.Models;
using PartSource.Services;
using System.Net;
using System.Threading.Tasks;
using System.Web.Http;
namespace PartSource.Controllers
{
[RoutePrefix("inventory")]
public class InventoryController : BaseNexpartController
{
private readonly InventoryService _inventoryService;
public InventoryController(InventoryService inventoryService)
{
_inventoryService = inventoryService;
}
[HttpGet]
[Route("sku/{sku}/storeNumber/{storeNumber}")]
public async Task<IHttpActionResult> GetInventory(int sku, int storeNumber)
{
ps_parts_availability inventory = _inventoryService.GetInventory(sku, storeNumber);
return inventory == null
? Content(HttpStatusCode.NotFound, $"No part matching SKU {sku} was found.")
: (IHttpActionResult)Ok(new
{
data = new
{
StoreNumber = inventory.Store,
Sku = sku,
Quantity = inventory.QTY
}
});
}
}
}