public ActionResult Survey(SurveyView survey)
        {
            //Survey result = new Survey();
            //result.ActivityLevel = survey.ActivityLevel;
            //result.EmailAddress = survey.EmailAddress;
            //result.State = survey.State;
            //result.ParkCode = Park;
            bool         wasSuccesful = false;
            ActionResult redirect;

            if (!ModelState.IsValid)
            {
                survey.Parks = _dal.GetAllParks();
                redirect     = View("Surveys", survey);
            }
            else
            {
                _dal.SaveSurvey(survey);
                var favorites = _dal.GetFavorites();
                redirect = View("Favorites", favorites);
            }
            //if (wasSuccesful)
            //{
            //    var favorites = _dal.GetFavorites();
            //    redirect = View("Favorites", favorites);
            //}
            //else
            //{
            //    redirect = View("Surveys", survey);
            //}

            return(redirect);
        }
Exemple #2
0
 public ActionResult Survey(Survey survey)
 {
     if (!ModelState.IsValid)
     {
         return(View("Survey", survey));
     }
     parkDAL.SaveSurvey(survey);
     return(RedirectToAction("SurveyResult", "Park"));
 }
Exemple #3
0
 public ActionResult TakeSurvey(Park completedSurvey)
 {
     if (!ModelState.IsValid)
     {
         return(View("TakeSurvey", completedSurvey));
     }
     else
     {
         dal.SaveSurvey(completedSurvey);
         return(RedirectToAction("SurveyResult"));
     }
 }
        public ActionResult Survey(SurveyView survey)
        {
            ActionResult redirect;

            if (!ModelState.IsValid)
            {
                survey.Parks = _dal.GetAllParks();
                redirect     = View("Surveys", survey);
            }
            else
            {
                _dal.SaveSurvey(survey);
                var favorites = _dal.GetFavorites();
                redirect = RedirectToAction("Favorites", favorites);
            }


            return(redirect);
        }
        public ActionResult NewSurvey(Survey newSurvey)
        {
            List <Park> Parks = parkDAL.GetAllParks();

            if (!ModelState.IsValid)
            {
                foreach (var park in Parks)
                {
                    newSurvey.ParkNames.Add(new SelectListItem {
                        Text = park.Name, Value = park.ParkImage
                    });
                }

                return(View("NewSurvey", newSurvey));
            }

            parkDAL.SaveSurvey(newSurvey);
            return(RedirectToAction("SurveyResult"));
        }
 public ActionResult TakeSurvey(Park completedSurvey)
 {
     dal.SaveSurvey(completedSurvey);
     return(RedirectToAction("SurveyResult"));
 }