コード例 #1
0
        public async Task Update(Customer customer)
        {
            Entities.Customer customerEntity = new Entities.Customer()
            {
                Id     = customer.Id,
                Name   = customer.Name,
                Aadhar = customer.Aadhar
            };

            _context.Customers.Update(customerEntity);
            await _context.SaveChangesAsync();
        }
コード例 #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.Aadhar, accountCollection));
        }