public void SaveItemMasterDetails(Billing_Item billingItem) { BillingDbContextBll db = new BillingDbContextBll(); if (billingItem.ItemID == 0) { db.Entry(billingItem).State = System.Data.Entity.EntityState.Added; } else { db.Entry(billingItem).State = System.Data.Entity.EntityState.Modified; } db.SaveChanges(); }
public void DeleteBillItemDetailsBasedOnId(int itemId) { Billing_Item billingItem = new Billing_Item(); BillingDbContextBll db = new BillingDbContextBll(); billingItem = db.BillingItem.FirstOrDefault(a => a.ItemID == itemId); db.Entry(billingItem).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); }