public ActionResult Cart(CartViewModel cartViewModel) { OrderDto order = (OrderDto)HttpContext.Session["CurrentOrder"]; vm.ProductList = ConvertToDTO(productService.RetriveProductList()); cartViewModel.Selectlist = PopulateList(); SelectListItem selected = null; if (cartViewModel.ProductPrice != null) { selected = cartViewModel.Selectlist.Find (m => m.Value == cartViewModel.ProductPrice.ToString()); } if (selected != null) { selected.Selected = true; cartViewModel.Message = "Product : " + selected.Text + " Price : " + selected.Value + " Quantity : " + cartViewModel.Quantity; if (cartViewModel.Quantity != 0 && selected.Text != "Please select") { var product = productService.GetProduct(selected.Text); var productDto = ConvertToDTO(product); order.AddLineItem(new LineItemDto (productDto, cartViewModel.Quantity), order.LineItemList); } } cartViewModel.LineItemList = order.LineItemList; HttpContext.Session["CurrentOrder"] = order; return(View(cartViewModel)); }