public IActionResult Get(int orderId) { var order = _angularBasicRepository.GetOrderById(User.Identity.Name, orderId); if (order != null) { return(Ok(_mapper.Map <IEnumerable <OrderItem>, IEnumerable <OrderItemViewModel> >(order.Items))); } return(NotFound()); }
public IActionResult Get(int orderId, int id) { try { var order = _angularBasicRepository.GetOrderById(User.Identity.Name, orderId); if (order != null) { var item = order.Items.Where(i => i.Id == id).FirstOrDefault(); if (item != null) { return(Ok(_mapper.Map <Order, OrderViewModel>(order))); } } return(NotFound()); } catch (Exception ex) { return(BadRequest("Failed to get orders")); } }