示例#1
0
 public ActionResult Edit(Person person)
 {
     if (ModelState.IsValid)
     {
         context.Entry(person).State = EntityState.Modified;
         context.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(person);
 }
示例#2
0
        public ActionResult Create(Person person)
        {
            if (ModelState.IsValid)
            {
                context.People.Add(person);
                context.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(person);
        }