Пример #1
0
 /// <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();
     }
 }
Пример #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); });
        }
Пример #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();
        }
Пример #4
0
 /// <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();
 }
Пример #5
0
 public void Add(Domain.Models.Customer customer)
 {
     _context.Customers.Add(customer);
     _context.SaveChanges();
 }
Пример #6
0
 public void Update(Domain.Models.Customer customer)
 {
     // No-op
 }
Пример #7
0
 public void Add(Domain.Models.Customer customer)
 {
     throw new NotImplementedException();
 }
Пример #8
0
 internal Customer(Domain.Models.Customer entity)
 {
     Entity = entity;
 }