8.2 Building the Shopping Cart; Listing 8-16 The Index Action Method in the CartController.cs File

This commit is contained in:
Jason Zhu 2021-09-18 18:25:55 +10:00
parent 4436c60e79
commit b64c59264b

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using SportsStore.WebUI.Models;
namespace SportsStore.WebUI.Controllers
{
@ -17,6 +18,15 @@ namespace SportsStore.WebUI.Controllers
repository = repo;
}
public ViewResult Index(string returnUrl)
{
return View(new CartIndexViewModel
{
Cart = GetCart(),
ReturnUrl = returnUrl
});
}
// GET: Cart
public RedirectToRouteResult AddToCart(int productId, string returnUrl)
{