3using Microsoft.EntityFrameworkCore;
37 .Include(p => p.PriceLists)
38 .Include(p => p.Modules)
39 .ThenInclude(m => m.ModuleLevels)
40 .ThenInclude(ml => ml.PriceElements)
41 .ThenInclude(pe => pe.PriceList)
42 .ThenInclude(pl => pl.Currency)
43 .Include(p => p.Agreements)
44 .ThenInclude(a => a.AgreementElements)
71 throw new InvalidOperationException($
"Unique name violation.");
74 await
_db.SaveChangesAsync();
89 throw new InvalidOperationException($
"Unique name violation.");
92 await
_db.SaveChangesAsync();
DbSet< Product > Products
ProductService class inserts and updates Product in the Database
async Task< Product > GetProductById(int id)
Read one Product with id from database
async Task< List< Product > > GetAllProducts()
Read all Products from database
async Task< Product > UpdateProduct(Product product)
Updates changes on a Product in the database
async Task< List< Product > > GetAllProductWithChildren()
Read all Products from database included referenced tables
ProductService(DataContext db)
async Task< Product > AddProduct(Product product)
Adds a Product to the database