public async Task <IActionResult> GetOrders(int OrderId)
        {
            try
            {
                var result = await _services.GetOrderHistory(OrderId);

                if (result?.Count > 0)
                {
                    return(Ok(result));
                }
                return(NotFound());
            }
            catch (KeyNotFoundException)
            {
                return(BadRequest());
            }
        }
        public async Task <IActionResult> GetOrderHistory(int id)
        {
            var result = await _service.GetOrderHistory(id);

            return(Ok(result));
        }
예제 #3
0
 /// <summary>
 /// This is the actual consumer which calls teh OrderHistoryService and that service essentials is a HTTP Client to cal the API
 /// For the purpose of this assignment we don't need to write HTTP Client as we are going to mock it
 /// </summary>
 /// <param name="customerNumber"></param>
 /// <returns></returns>
 public List <OrderHistoryItem> GetCustomerOrderHistory(string customerNumber)
 {
     return(_orderHistoryService.GetOrderHistory(customerNumber));
 }