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

            return(mapper.Map <Customer>(await Get(customer)));
        }
Example #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));
        }
Example #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()));
 }
Example #4
0
 public Task <IEnumerable <Order> > GetByCustomerAsync(ICustomerIdentity customer)
 {
     return(OrderDataAccess.GetByCustomerAsync(customer));
 }
Example #5
0
 public Task <Customer> GetAsync(ICustomerIdentity customer)
 {
     return(CustomerDataAccess.GetAsync(customer));
 }