public ActionResult SubmitSurvey(survey_result survey) { using (var context = new ParkSystemDatabaseEntities()) { context.survey_result.Add(survey); context.SaveChanges(); } return RedirectToAction("SurveyResult"); }
public ActionResult SubmitSurvey(survey_result survey) { if (ModelState.IsValid) { using (var context = new ParkSystemDatabaseEntities()) { context.survey_result.Add(survey); context.SaveChanges(); } return(RedirectToAction("SurveyResult")); } else { return(View("Survey", survey)); } }
public ActionResult Survey(SurveyModel theSurvey) { if (ModelState.IsValid) { using (var context = new ParkSystemDatabaseEntities()) { context.survey_result.Add(theSurvey.Survey); context.SaveChanges(); } return(RedirectToAction("SurveyResult")); } else { SurveyModel survey = new SurveyModel(); survey.Fahrenheit = CheckTemp(); using (var context = new ParkSystemDatabaseEntities()) { survey.Parks = context.parks.ToList(); } survey.Survey = theSurvey.Survey; return(View(survey)); } }