I am using EPiServer CMS 10 hosted on Azure cloud. I am creating custom commerce site. I have created page for products. When user clicks on Add to cart button, I want to store the values in MVC session. I have written AddToSession method in the page controller. I want to access the controller method from razor view when user clicks on button. Below is my controller method:
public class ProductPageController : PageController {
public ActionResult AddToSession(OrderDetails ordObj) { if (Session["OrderDetails"] != null) { var ordSession = Session["OrderDetails"] as List; ordSession.Add(ordObj); } else { Session["OrderDetails"] = ordObj; }
Hi,
I am using EPiServer CMS 10 hosted on Azure cloud. I am creating custom commerce site. I have created page for products. When user clicks on Add to cart button, I want to store the values in MVC session. I have written AddToSession method in the page controller. I want to access the controller method from razor view when user clicks on button. Below is my controller method:
public class ProductPageController : PageController
{
public ActionResult AddToSession(OrderDetails ordObj);
{
if (Session["OrderDetails"] != null)
{
var ordSession = Session["OrderDetails"] as List
ordSession.Add(ordObj);
}
else
{
Session["OrderDetails"] = ordObj;
}
return null;
}
}
View:
How can I do this?
//Sanket Mahimkar