Exemplo n.º 1
0
        async Task IRepository.DeleteCustomer(int CustomerId)
        {
            EfModels.Customer store = await _context.Customers.FindAsync(CustomerId);

            _context.Customers.Remove(store);
            await _context.SaveChangesAsync();
        }
Exemplo n.º 2
0
        async Task IRepository.AddCustomer(BusinessModels.Customer customer)
        {
            // pass in all the values of customer and place them in.
            EfModels.Customer newCustomer = new EfModels.Customer()
            {
                FirstName = customer.FirstName,
                LastName  = customer.LastName,
                Email     = customer.Email,
                Phone     = customer.Phone
            };

            // add customer to context
            await _context.AddAsync(newCustomer);

            await _context.SaveChangesAsync();
        }
Exemplo n.º 3
0
        async Task <BusinessModels.Customer> IRepository.FindCustomer(int CustomerId)
        {
            EfModels.Customer e = await _context.Customers.FindAsync(CustomerId);

            return(new BusinessModels.Customer(e.CustomerId, e.FirstName, e.LastName, e.Email, e.Phone));
        }