public Sale GetById(int id) { using (var ctx = new BasicEFCoreDbContext(optionsBuilder.Options)) { return(ctx.Sales.FirstOrDefault(p => p.Id == id)); } }
public List <Sale> GetAll() { using (var ctx = new BasicEFCoreDbContext(optionsBuilder.Options)) { return(ctx.Sales.ToList()); } }
public List <SaleItem> GetAll() { using (var ctx = new BasicEFCoreDbContext(options)) { return(ctx.SaleItems.ToList()); } }
public void Add(Sale sale) { using (var ctx = new BasicEFCoreDbContext(optionsBuilder.Options)) { ctx.Sales.Add(sale); ctx.SaveChanges(); } }
public void Add(SaleItem saleItem) { using (var ctx = new BasicEFCoreDbContext(options)) { ctx.SaleItems.Add(saleItem); ctx.SaveChanges(); } }