public IActionResult Checkout(Order order) { if (order?.Items?.Any() != true) { return(RedirectToAction("GetAll")); } var items = catalogueService.GetByIds(order.Items.Select(item => item.Id)); var user = (order.User?.Id).HasValue ? userService.GetById(order.User.Id) : null; var orderViewModel = new OrderViewModel() { Items = items .Join(order.Items, i => i.Id, i => i.Id, (item, order) => new OrderItemViewModel(item, order.Count)) .ToList(), User = user }; return(View("../Order/Order", orderViewModel)); }