public ActionResult BasicForm(School model) { if (ModelState.IsValid) { var template = "{0}: {1}<br/>"; StringBuilder builder = new StringBuilder(); builder.AppendLine("You sumitted the following values:<br/>"); builder.AppendLine(string.Format(template, "Name", model.Name)); builder.AppendLine(string.Format(template, "Phone number", model.PhoneNumber)); ViewBag.Message = builder.ToString(); } return View(); }
public JsonResult ThrowError(School model) { throw new Exception("The website crapped all over itself."); }
public JsonResult GetJson(School model) { //This will return a JSON object of the model return Json(model); }
public ActionResult AjaxForm(School model) { return PartialView("_UpdateMePartial", model); }