3using Microsoft.EntityFrameworkCore;
28 .Include(pe => pe.PriceList)
29 .ThenInclude(pl => pl.Currency)
55 await
_db.SaveChangesAsync();
69 await
_db.SaveChangesAsync();
82 if (priceElement ==
null)
throw new NullReferenceException($
"PriceElement with id {id} doesn't exist.");
83 priceElement.IsActive =
false;
97 if (priceElement ==
null)
throw new NullReferenceException($
"PriceElement with id {id} doesn't exist.");
98 priceElement.IsActive =
true;
DbSet< PriceElement > PriceElements
PriceElementService class inserts and updates PriceElement in the Database
async Task< PriceElement > ActivatePriceElement(int id)
Activates a PriceElement by setting IsActive attribute to false
async Task< PriceElement > GetPriceElementById(int id)
Read one PriceElement with id from database
PriceElementService(DataContext db)
async Task< PriceElement > AddPriceElement(PriceElement priceElement)
Adds a PriceElement to the database
async Task< PriceElement > DeactivatePriceElement(int id)
Deactivates a PriceElement by setting IsActive attribute to false
async Task< List< PriceElement > > GetAllPriceElements()
Read all PriceElements from database
async Task< PriceElement > UpdatePriceElement(PriceElement priceElement)
Updates changes on a PriceElement in the database