Exemplo n.º 1
0
 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");
 }
Exemplo n.º 2
0
 //
 // GET: /Index/
 public ActionResult Index()
 {
     School schoolDb = new School();
     return View(schoolDb.Persons.ToList());
 }