public ActionResult UserPreset(Models.PizzaModel pizzamodel) { //create pizza Pizzaboxdomain.Pizza piz = new Pizza(); piz.crust = pizzamodel.PizzaCrust; piz.size = pizzamodel.PizzaSize; piz.quantity = pizzamodel.PizzaQuantity; List <String> templist = new List <string>() { pizzamodel.PizzaTopping1, pizzamodel.PizzaTopping2, pizzamodel.PizzaTopping3, pizzamodel.PizzaTopping4, pizzamodel.PizzaTopping5 }; //remove blank entries from templist templist = templist.Where(s => !string.IsNullOrWhiteSpace(s)).ToList(); piz.toppings = templist; //create pizzastring piz.PizzaString = piz.showPizza(); //find out what number of pizza this order is int pizzacounter = (int)HttpContext.Session.GetInt32("pizzacounter"); //increment pizzacounter by 1 pizzacounter = pizzacounter + 1; //set pizzacounter session variable to new pizzacounter HttpContext.Session.SetInt32("pizzacounter", pizzacounter); //note that we will always have pizzacounter - 1 pizzas //add pizza string to a session; HttpContext.Session.SetString($"pizzastring{pizzacounter}", piz.PizzaString); //find out how many pizzas we got //first i need to recreate all of our pizzaobjects and add them to tempOrder for (int i = 0; i < pizzacounter; i++) { //intialize temppizzastring string temppizzastring = ""; temppizzastring = HttpContext.Session.GetString($"pizzastring{i+1}"); Pizza mypiz = new Pizza(); mypiz = mypiz.recreatePizza(temppizzastring); tempOrder.addPizza(mypiz); } HttpContext.Session.SetInt32("pizzacount", tempOrder.getCount()); ViewData["count"] = HttpContext.Session.GetInt32("pizzacount"); //find out what our cost is at, in string form for some reason i can't explain //get current cost total string currentcoststring = HttpContext.Session.GetString("pizzacost"); //convert current cost to double double currentcostdouble = Convert.ToDouble(currentcoststring); //add current double cost with our new cost double double nextcostdouble = currentcostdouble + tempOrder.gettotalpizzacost(); //save new cost to session HttpContext.Session.SetString("pizzacost", nextcostdouble.ToString()); ViewData["cost"] = HttpContext.Session.GetString("pizzacost"); return(View()); }