예제 #1
0
        public IActionResult Get(int orderId)
        {
            var order = _repository.GetOrderById(User.Identity.Name, orderId);

            if (order != null)
            {
                return(Ok(_mapper.Map <IEnumerable <OrderItem>, IEnumerable <OrderItemViewModel> >(order.Items)));
            }
            return(NotFound());
        }
예제 #2
0
 public IActionResult GET(int id)
 {
     try
     {
         var order = _repository.GetOrderById(User.Identity.Name, id);
         if (order != null)
         {
             return(Ok(_mapper.Map <Order, OrderViewModel>(order)));
         }
         else
         {
             return(NotFound());
         }
     }
     catch (Exception)
     {
         _logger.LogError("ERROR ORDERS");
         return(BadRequest("ORDERS BAD"));
     }
 }