Example #1
0
        public IActionResult Index(CountryViewModel model)
        {
            if (ModelState.IsValid)
            {
                var msg = model.Country +  " selected";
                return RedirectToAction("IndexSuccess", new { message = msg});
            }

            // If we got this far, something failed; redisplay form.
            return View(model);
        }
Example #2
0
 public IActionResult Index()
 {
     var model = new CountryViewModel();
     model.Country = "CA";
     return View(model);
 }
Example #3
0
        public IActionResult IndexEmpty(CountryViewModel model)
        {
            if (ModelState.IsValid)
            {
                var msg = !System.String.IsNullOrEmpty(model.Country) ? model.Country
                    : "No slection";
                msg += " Selected";
                return RedirectToAction("IndexSuccess", new { message = msg });
            }

            return View(model);
        }