public ActionResult Create(Person person) { if (ModelState.IsValid) { _people.Add(person); Success(string.Format("<b>{0}</b> was successfully added to the database.", person.FirstName), true); return RedirectToAction("Index"); } Danger("Looks like something went wrong. Please check your form."); return View(person); }
// GET: Simple public ActionResult Index() { var person = new Person { FirstName = "Billy Jo", LastName = "McGuffery", BirthDate = new DateTime(1990, 6, 1), LikesMusic = true, EmailAddress = "*****@*****.**", Skills = new List<string>() {"Math", "Science", "History"} }; return View(person); }
public ActionResult Create() { var person = new Person(); return View(person); }