public ActionResult Contact(ContactUs model) { if (!ModelState.IsValid) { ViewBag.Title = "Contact"; ModelState.AddModelError("", "Please fill all required fields"); return View(model); } //do something return RedirectToAction("Index"); }
public ActionResult Contact() { ContactUs model = new ContactUs(); ViewBag.Title = "Contact"; return View(model); }