Example #1
0
        public ActionResult Index(Survey survey)
        {
            // Save the Survey
            surveyDal.SaveSurvey(survey);

            // Redirect the user to the Confirmation Page
            //return View();
            return(RedirectToAction("Confirmation", "Survey"));
        }
 public ActionResult Survey(Survey survey)
 {
     if (ModelState.IsValid)
     {
         SurveySqlDAL dal = new SurveySqlDAL(connectionString);
         dal.SaveSurvey(survey);
         return(RedirectToAction("SurveyResults"));
     }
     return(View("Survey", survey));
 }
Example #3
0
        public IActionResult NewSurvey(SurveyModel surveyModel)
        {
            if (!ModelState.IsValid)
            {
                Dictionary <string, string> parks = parkSqlDAL.GetParkNames();

                SurveyModel surveyModelReplacement = new SurveyModel();
                surveyModelReplacement.ParksByName(parks);

                return(View("Index", surveyModelReplacement));
            }

            surveySqlDAL.SaveSurvey(surveyModel);

            return(RedirectToAction("SurveyResults"));
        }
 public IActionResult New(Survey survey)
 {
     if (ModelState.IsValid)
     {
         dal.SaveSurvey(survey);
         TempData["Show_Message"] = true;
         return(RedirectToAction("Index"));
     }
     else
     {
         var ParkCodes = parkCodes.Select(code => new SelectListItem()
         {
             Text = code, Value = code
         });
         ParkCodes.Append(new SelectListItem()
         {
             Text = "--Select A Park", Value = null, Selected = true, Disabled = true
         });
         ViewBag.ParkCodes = ParkCodes;
         return(View(survey));
     }
 }