using WebApplication1.models; var builder = WebApplication.CreateBuilder(args); var app = builder.Build(); // сюда будем добавлять свои конечные точки var dbDataProvider = new DBDataProvider(); app.MapGet("/product", (int? pageNum) => { return dbDataProvider.getProduct(pageNum ?? 1); }); app.MapPost("/product", (Product newProduct) => { dbDataProvider.saveProduct(newProduct); }); app.MapPut("/product", (Product editProduct) => { dbDataProvider.saveProduct(editProduct); }); app.MapDelete( "/product/{id:int}", (int id) => { dbDataProvider.removeProduct(id); }); app.MapPut("/product", (Product editProduct) => { dbDataProvider.saveProduct(editProduct); }); app.MapGet("/productCount", () => { return dbDataProvider.getProductCount(); }); app.MapPut("/minCostForAgent/{minCost:decimal}", (decimal minCost, int[] ids) => { dbDataProvider.setMinCostForAgent(minCost, ids); }); app.MapGet("/saleCount/{ID:int}", (int ID) => { return dbDataProvider.saleCount(ID); }); app.MapDelete("/productMaterial/{ID:int}", (int ID) => { dbDataProvider.removeProductMaterial(ID); }); app.MapDelete("/PriceHistory/{ID:int}", (int ID) => { dbDataProvider.removePriceHistory(ID); }); app.MapGet("/productMaterial/{ID:int}", (int ID) => { return dbDataProvider.getProductMaterials(ID); }); app.MapGet("/AvailableMaterials", () => { return dbDataProvider.getAvailableMaterials(); }); app.MapGet("/ProductTypes", () => { return dbDataProvider.getProductTypes(); }); app.MapPost("/productMaterial", (ProductMaterial material) => { dbDataProvider.addProductMaterial(material); }); app.MapPut("/setOrder", (string condition) => { dbDataProvider.setOrder(condition); }); app.MapPut("/addFilter", (string name, object value) => { dbDataProvider.addFilter(name, value); }); app.MapPut("/clearFilter", () => { dbDataProvider.clearFilter(); }); app.Run();