/// <summary> /// Update uses context to "listen" for any change then /// saves changes to the State of customer /// </summary> /// <param name="customer"></param> public void Update(Domain.Models.Customer customer) { if (_context.Entry(customer).State == System.Data.Entity.EntityState.Modified) { _context.SaveChanges(); } }
public async void Add(Domain.Models.Customer customer) { if (customer.Id == null) { customer.AddID(Guid.NewGuid()); } Flat.CadCustomer.Add(customer); await Task.Factory.StartNew(() => { Flat.SetCadastro <Customer>(Flat.CadCustomer, Flat.ArqCustomer); }); }
/// <summary> /// Save (Insert/Update) a customer to database /// </summary> /// <param name="customer">Object of customer to insert</param> public void Save(Domain.Models.Customer customer) { var testCustomer = GetByEmail(customer.Email); if (testCustomer != null) { customer.Id = testCustomer.Id; } _desafioContext.Customers.Update(customer); _desafioContext.SaveChanges(); }
/// <summary> /// Delete Method /// This removes it to both context and DB (be careful) /// </summary> /// <param name="customer"></param> public void Delete(Domain.Models.Customer customer) { _context.Customers.Remove(customer); _context.SaveChanges(); }
public void Add(Domain.Models.Customer customer) { _context.Customers.Add(customer); _context.SaveChanges(); }
public void Update(Domain.Models.Customer customer) { // No-op }
public void Add(Domain.Models.Customer customer) { throw new NotImplementedException(); }
internal Customer(Domain.Models.Customer entity) { Entity = entity; }