public bool AddBilling(Billing model) { try { entities.Billings.Add(model); entities.SaveChanges(); return true; } catch (Exception x) { throw x; } }
public bool UpdateBilling(Billing model) { try { Billing billing = entities.Billings.Where(x => x.BillingId == model.BillingId).SingleOrDefault(); if (billing != null) { entities.Entry(billing).CurrentValues.SetValues(model); entities.SaveChanges(); return true; } else { return false; } } catch (Exception x) { throw x; } }