public void Update(BillDto bill) { var context = new BillModel(); context.Bills.AddOrUpdate(BillDto.ToBill(bill)); context.SaveChanges(); }
public void Delete(int id) { var context = new BillModel(); var bill = context.Bills.FirstOrDefault((x) => x.Id == id); context.Bills.Remove(bill); context.SaveChanges(); }
public int Create(BillDto bill) { var newBill = BillDto.ToBill(bill); var context = new BillModel(); context.Bills.Add(newBill); context.SaveChanges(); return(newBill.Id); }