// GET: Greetings public ActionResult Index(string name) { var model = new GreetingsViewModel(); model.Name = name ?? "no name"; model.Message = ConfigurationManager.AppSettings["message"]; return(View(model)); }
public IActionResult GreetingsGet(string yourname, string childname) { var viewModel = new GreetingsViewModel { YourFirstName = yourname, ChildFirstName = childname, Greetings = new List <Greetings> { Greetings.BestMumInTheWorld, Greetings.HaveARelaxingDay } }; return(View("Greetings", viewModel)); }
public IActionResult GreetingsPost(GreetingsViewModel viewModel) { viewModel.ParseAndValidateParameters(Request, m => m.Greetings); if (viewModel.HasAnyErrors()) { return(View("Greetings", viewModel)); } return(RedirectToAction("HappyMothersDayGet", "Home", new { yourname = viewModel.YourFirstName, childname = viewModel.ChildFirstName, bestmum = viewModel.Greetings.Contains(Greetings.BestMumInTheWorld), relaxingday = viewModel.Greetings.Contains(Greetings.HaveARelaxingDay) })); }