public static ShoppingCartVM GetShoppingCart() { ShoppingCartMapper shoppingCartMapper = new ShoppingCartMapper(); ShoppingCart shoppingCart = shoppingCartMapper.GetShoppingCart(); shoppingCart.TotalPrice = TotalPrice(shoppingCart); LoginVM loginVm = new LoginVM(shoppingCart.User.EmailAddress, shoppingCart.User.Password); List<ShoppingCartItemVM> shoppingCartItemVmList = new List<ShoppingCartItemVM>(); foreach (var shoppingCartItem in shoppingCart.ShoppingCartItemsList) { var shoppingCartItemVM=new ShoppingCartItemVM(shoppingCartItem.IdProduct, shoppingCartItem.Quantity); shoppingCartItemVmList.Add(shoppingCartItemVM); } ShoppingCartVM shoppingCartVM = new ShoppingCartVM(shoppingCart.Id, loginVm, shoppingCart.TotalPrice,shoppingCartItemVmList); return shoppingCartVM; }