public async Task <ActionResult> OnPost() { if (ModelState.IsValid) { string[] newPoses = new string[7]; string[] jsonPoses = new string[7]; string poseStr1 = HttpContext.Request.Form["NewPose_1"]; string[] poseInfo = poseStr1.Split("/"); newPoses[0] = poseInfo[2]; string poseStr2 = HttpContext.Request.Form["NewPose_2"]; poseInfo = poseStr2.Split("/"); newPoses[1] = poseInfo[2]; string poseStr3 = HttpContext.Request.Form["NewPose_3"]; poseInfo = poseStr3.Split("/"); newPoses[2] = poseInfo[2]; string poseStr4 = HttpContext.Request.Form["NewPose_4"]; poseInfo = poseStr4.Split("/"); newPoses[3] = poseInfo[2]; string poseStr5 = HttpContext.Request.Form["NewPose_5"]; poseInfo = poseStr5.Split("/"); newPoses[4] = poseInfo[2]; string poseStr6 = HttpContext.Request.Form["NewPose_6"]; poseInfo = poseStr6.Split("/"); newPoses[5] = poseInfo[2]; string poseStr7 = HttpContext.Request.Form["NewPose_7"]; poseInfo = poseStr7.Split("/"); newPoses[6] = poseInfo[2]; this.PoseList = new List <Poses>(); ChakraList = await cosmosDbService.GetChakrasAsync(); for (int i = 0; i < 7; i++) { PoseList.Add(ChakraList[i].Poses.Where(x => x.name == newPoses[i]).FirstOrDefault()); jsonPoses[i] = new JavaScriptSerializer().Serialize(PoseList[i]); } Poses[] TempArray = PoseList.ToArray(); //TempData.Set("Poses", TempArray); //TempData["jsonPoses"] = jsonPoses; TempData.Set("PoseList", PoseList.ToArray()); return(RedirectToPage("ClassPreference")); } return(Page()); }
public async Task <IActionResult> OnPostAsync() { //If coming from the Class Settings Page if (FromStage == 2) { //Load the Poses already selected. this.PoseList = TempData.Get <Poses[]>("PoseList").ToList(); //Load the Charkra list. This is for the Select Lists of poses ChakraList = await cosmosDbService.GetChakrasAsync(); } else { if (ModelState.IsValid) { //Save the list of poses for later use. TempData.Set("PoseList", PoseList.ToArray()); return(RedirectToPage("ClassPreference2")); } } return(Page()); }