/// <summary> /// Gets all order details by shopping cart id /// </summary> /// <param name="shoppingCartId">The Id of the shopping cart</param> /// <returns>Collection of OrderDetailsViewModel</returns> public async Task <OrderDetailsViewModel> GetOrderDetailsAsync(int shoppingCartId) { OrderDetailsViewModel model = new OrderDetailsViewModel(); var products = await this.dbContext.ShoppingCartDetails .Where(scd => scd.ShoppingCartId == shoppingCartId) .Select(p => new OrderProductItemViewModel { Title = p.Product.Title, Price = p.Product.Price, RentPrice = p.Product.RentPrice, Quantity = p.Quantity, Description = p.Product.Description.TrimDescription(), ProductId = p.ProductId }) .ToListAsync(); model.Products = products; List <SelectListItem> paymentOptions = new List <SelectListItem>(); var options = Enum.GetValues(typeof(PaymentType)); foreach (var option in options) { paymentOptions.Add(new SelectListItem { Text = PaymentTypeHelper.GetName((PaymentType)option), Value = ((int)option).ToString() }); } model.PaymentOptions = paymentOptions; return(model); }