Ejemplo n.º 1
0
        public async Task Update(Customer customer)
        {
            Entities.Customer customerEntity = new Entities.Customer()
            {
                Id   = customer.Id,
                Name = customer.Name,
                SSN  = customer.SSN
            };

            _context.Customers.Update(customerEntity);
            await _context.SaveChangesAsync();
        }
Ejemplo n.º 2
0
        public async Task <Customer> Get(Guid id)
        {
            Entities.Customer customer = await _context.Customers
                                         .FindAsync(id);

            List <Guid> accounts = await _context.Accounts
                                   .Where(e => e.CustomerId == id)
                                   .Select(p => p.Id)
                                   .ToListAsync();

            AccountCollection accountCollection = new AccountCollection();

            foreach (var accountId in accounts)
            {
                accountCollection.Add(accountId);
            }

            return(Customer.Load(customer.Id, customer.Name, customer.SSN, accountCollection));
        }