public ActionResult Index(HomeModel model) { if (ModelState.IsValid) { return RedirectToAction("Thanks", new { name = model.Name }); } return View(); }
public ActionResult Ajax(HomeModel model) { var response = new AjaxResponse(); if (ModelState.IsValid) { response.Message = $"Thanks {model.Name}!"; return Json(response); } response.Message = "No luck!"; return Json(response); }