Example #1
0
        public ActionResult Index(HomeModel model)
        {
            if (ModelState.IsValid)
            {
                return RedirectToAction("Thanks", new { name = model.Name });
            }

            return View();
        }
Example #2
0
        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);
        }