public void Add(Customer customer) { using (var context = new RepositoryContext()) { context.CustomersCollection.Add(customer); context.SaveChanges(); } }
public void Add(Transaction customer) { using (var context = new RepositoryContext()) { context.CustomersCollection.Attach(customer.Customer); context.TransactionCollection.Add(customer); context.SaveChanges(); } }
public void UpdateCustomer(Customer customer) { using (var context = new RepositoryContext()) { context.CustomersCollection.Attach(customer); var entry = context.Entry(customer); entry.Property(x => x.Name).IsModified = true; entry.Property(x => x.Surmame).IsModified = true; context.SaveChanges(); } }