public ActionResult Add() { School schoolDb = new School(); schoolDb.Persons.Add(new Person { Name = "seasun", Age = 25 }); schoolDb.Persons.Add(new Person { Name = "小蔣", Age = 26, Number = 1 }); schoolDb.SaveChanges(); return RedirectToAction("Index"); }
// // GET: /Index/ public ActionResult Index() { School schoolDb = new School(); return View(schoolDb.Persons.ToList()); }