public IActionResult Get(int orderId)
        {
            var order = _repository.GetOrderById(orderId);

            if (order != null)
            {
                return(Ok(_mapper.Map <IEnumerable <OrderItem>, IEnumerable <OrderItemHairOrder> >(order.Items)));
            }
            return(NotFound());
        }
Пример #2
0
 public IActionResult Get(int id)
 {
     try
     {
         var order = _repository.GetOrderById(id);
         if (order != null)
         {
             return(Ok(_mapper.Map <Order, ViewHairOrder>(order)));
         }
         else
         {
             return(NotFound());
         }
     }
     catch (Exception exc)
     {
         _logger.LogError($"Failed to get orders: {exc}");
         return(BadRequest("Failed to get orders"));
     }
 }