diff --git a/barkmanAPI/Program.cs b/barkmanAPI/Program.cs index a98a7fd..154f591 100644 --- a/barkmanAPI/Program.cs +++ b/barkmanAPI/Program.cs @@ -85,11 +85,19 @@ inventoryGroup.MapPut("/{id}", async (int id, InventoryItems updatedItem, BarkCo }); -inventoryGroup.MapPost("", async (InventoryItems newItem, BarkContext db) => +inventoryGroup.MapPost("", async (InventoryItems newItemInput, BarkContext db) => { + var newItem = new InventoryItems(); + newItemInput.Name = newItem.Name; + newItem.Brand = newItemInput.Brand; + newItem.SerialNumber = newItemInput.SerialNumber; + newItem.RentalPrice = newItemInput.RentalPrice; + newItem.ReplacementCost = newItemInput.ReplacementCost; + newItem.StatusId = "ready"; + db.Inventory.Add(newItem); await db.SaveChangesAsync(); - return Results.Created($"/inventory/{newItem.Id}", newItem); + return Results.Created($"/inventory/{newItemInput.Id}", newItemInput); }); inventoryGroup.MapDelete("/{id}", async (int id, BarkContext db) => diff --git a/barkmanui/.env b/barkmanui/.env index 29a2dbd..1104091 100644 --- a/barkmanui/.env +++ b/barkmanui/.env @@ -1 +1,4 @@ -VITE_API_URL=https://barkdev.ts.drewr.io \ No newline at end of file +#Staging API +VITE_API_URL=https://barkdev.ts.drewr.io +#Local Dev API +#VITE_API_URL=http://localhost:5145 \ No newline at end of file