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); }
public IActionResult Index() { var model = new CountryViewModel(); model.Country = "CA"; return View(model); }
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); }