public ActionResult ViewCart(int userTableID) { // create the variables for the item and final decimal finalTotal; decimal itemTotal; // create a new instance of cartViewModel CartViewModel _cartViewModel = new CartViewModel(); _cartViewModel.listOfItemsPO = _mapper.Map(_cartDataAccess.ViewCart(userTableID)); finalTotal = _cartBusinessLogic.GetFinalTotal(_mapper.GetProductInfoList(_cartViewModel.listOfItemsPO)); _cartViewModel.finalTotal = finalTotal; _cartViewModel._userTableID = userTableID; _cartViewModel.productQuantity = _cartViewModel.singleItemPO.productQuantity; foreach (CartPO singleItem in _cartViewModel.listOfItemsPO) { itemTotal = _cartBusinessLogic.GetProductTotal(_mapper.GetProductInfo(singleItem)); singleItem.total = itemTotal; } // return the view return(View(_cartViewModel)); }