public bool Add(Costumer model) { try { _costumerDbContext.Add(model); _costumerDbContext.SaveChanges(); } catch (System.Exception) { return(false); } return(true); }
public bool Add(Invoice model) { try { _costumerDbContext.Add(model); _costumerDbContext.SaveChanges(); var id = model.InvoiceId; (from d in _costumerDbContext.InvoiceDetail where d.InvoiceId == 0 select d).ToList().ForEach(x => x.InvoiceId = id); _costumerDbContext.SaveChanges(); } catch (System.Exception) { return(false); } return(true); }
public bool Add(InvoiceDetail model) { try { _costumerDbContext.Add(model); _costumerDbContext.SaveChanges(); var id = model.ProductId; var quantity = model.Quantity; (from p in _costumerDbContext.Product where p.ProductId == id select p).ToList().ForEach(x => x.Quantity = (x.Quantity - quantity)); _costumerDbContext.SaveChanges(); } catch (System.Exception) { return(false); } return(true); }