Beispiel #1
0
        public async Task <Customer> GetAsync(ICustomerIdentity customer)
        {
            if (customer == null)
            {
                throw new ArgumentNullException(nameof(customer));
            }

            return(mapper.Map <Customer>(await Get(customer)));
        }
Beispiel #2
0
        private async Task <Entities.Customer> Get(ICustomerIdentity customer)
        {
            if (customer == null)
            {
                throw new ArgumentNullException(nameof(customer));
            }

            return(await context.Customers.Include(x => x.Orders)
                   .FirstOrDefaultAsync(x => x.Id == customer.Id));
        }
Beispiel #3
0
 public async Task <IEnumerable <Order> > GetByCustomerAsync(ICustomerIdentity customer)
 {
     return(mapper.Map <IEnumerable <Order> >(await context.Orders.Where(x => x.CustomerId == customer.Id).Include(x => x.Book)
                                              .Include(x => x.Customer).ToListAsync()));
 }
Beispiel #4
0
 public Task <IEnumerable <Order> > GetByCustomerAsync(ICustomerIdentity customer)
 {
     return(OrderDataAccess.GetByCustomerAsync(customer));
 }
Beispiel #5
0
 public Task <Customer> GetAsync(ICustomerIdentity customer)
 {
     return(CustomerDataAccess.GetAsync(customer));
 }