mirror of
https://github.com/BarkProductions/barkman.git
synced 2026-06-13 06:11:55 +00:00
updates
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
|
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
|
||||||
builder.Services.AddDbContext<InventoryContext>();
|
builder.Services.AddDbContext<InventoryContext>();
|
||||||
@@ -29,12 +30,6 @@ app.MapGet("/inventory", async (InventoryContext dbContext) =>
|
|||||||
return Results.Ok(inventoryItems);
|
return Results.Ok(inventoryItems);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.MapPost("/inventory", async (InventoryContext dbContext, InventoryContext newItem) =>
|
|
||||||
{
|
|
||||||
dbContext.Add(newItem);
|
|
||||||
await dbContext.SaveChangesAsync();
|
|
||||||
return Results.Created($"/inventory/{newItem.Id}", newItem);
|
|
||||||
});
|
|
||||||
//app.MapGet("/inventory/{id}", (int id) => InventoryDb.GetInventory(id));
|
//app.MapGet("/inventory/{id}", (int id) => InventoryDb.GetInventory(id));
|
||||||
//app.MapPut("/inventory", (InventoryItem item) => InventoryDb.UpdateItem(item));
|
//app.MapPut("/inventory", (InventoryItem item) => InventoryDb.UpdateItem(item));
|
||||||
//app.MapDelete("/inventory/{id}", (int id) => InventoryDb.RemoveItem(id));
|
//app.MapDelete("/inventory/{id}", (int id) => InventoryDb.RemoveItem(id));
|
||||||
|
|||||||
Reference in New Issue
Block a user