public async Task <IActionResult> Details(int orderId) { OrderDto order = null; try { order = await _orderFacade.GetOrder(orderId); } catch (HttpRequestException) { _logger.LogWarning("Exception Occured using Order Facade"); order = null; } IEnumerable <ReviewDto> reviews = null; try { reviews = await _reviewFacade.GetCustomerReviews(1); /*reviews = await _reviewFacade.GetCustomerReviews(customerId);*/ } catch (HttpRequestException) { _logger.LogWarning("Exception Occured using Review Facade"); reviews = null; } List <OrderedItemViewModel> orderedItems = order.OrderedItems.Select(b => new OrderedItemViewModel { ProductId = b.ProductId, Quantity = b.Quantity, Price = b.Price, ProductName = b.ProductName, }).ToList(); foreach (var item in orderedItems) { if (reviews.Any(r => r.ProductId == item.ProductId)) { item.hasReviewed = true; } } OrderViewModel viewModel = new OrderViewModel { OrderId = order.OrderId, Date = order.Date, OrderedItems = orderedItems, TotalPrice = order.TotalPrice, }; return(View(viewModel)); }
public OrderDto Get(Guid id) { return(_orderFacade.GetOrder(id)); }