I have mvc 3 application in which in session object i'm taking all values that is needed to me as parameter to execute stored procedure.
If the userAction is update then execute stored procedure.
public ActionResult Index(string userAction)
{
if(Session["Mappings"] != null)
ViewData["Message"] = "Mapping web grid";
if (Session["PricingSecurities"] == null)
Session["PricingSecurities"] = objRepository.GetPricingSecurityID();
if (Session["Cusips"] == null)
Session["Cusips"] = objRepository.GetCUSIP();
SecurityMappingModel objModel = null;
mappings = (List<SecurityMappingModel>)Session["Mappings"];
objModel = new SecurityMappingModel();
if (userAction == "Update" )
{
//help me to fix this code
//foreach (var item in Session)
//{Session["Mappings"] //NEED FIX HERE
//}
// PLEASE HELP ME TO RETRIEVE SESSION VALUES
return RedirectToAction("Index");
}
return View(objModel);
}
HOW CAN I RETRIEVE ALL VALUES OF Session["Mappings"] it is holding 3entries 3ids,3cusips,3calculation