/// <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();
     }
 }
Exemple #2
0
        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); });
        }
Exemple #3
0
        /// <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();
 }
Exemple #6
0
 public void Update(Domain.Models.Customer customer)
 {
     // No-op
 }
Exemple #7
0
 public void Add(Domain.Models.Customer customer)
 {
     throw new NotImplementedException();
 }
Exemple #8
0
 internal Customer(Domain.Models.Customer entity)
 {
     Entity = entity;
 }