예제 #1
0
        public async Task <ActionResult <IEnumerable <CustomerOrderResource> > > GetAllAsync(int customerId)
        {
            //finding customer by customerid
            var customer = await _customerOrderService.FindCustomerAsync(customerId);

            if (customer == null)
            {
                return(NotFound());
            }
            var orders = await _customerOrderService.ListAsync(customerId);

            var resource = _mapper.Map <ActionResult <IEnumerable <Order> >, ActionResult <IEnumerable <CustomerOrderResource> > >(orders);

            return(resource);
        }