Exemplo n.º 1
0
        public ActionResult Edit(PersonInput vrpInput)
        {
            using (ApplicationContext vrlContext = new ApplicationContext())
            {
                Person person = vrlContext.Persons.FirstOrDefault(x => x.Id == vrpInput.Id);
                person.Age = vrpInput.Age;
                person.FirstName = vrpInput.FirstName;
                person.LastName = vrpInput.LastName;

                vrlContext.SaveChanges();
            }
            return RedirectToAction("Index");
        }
Exemplo n.º 2
0
 public ActionResult Edit(int id)
 {
     using (ApplicationContext vrlContext = new ApplicationContext())
     {
         Person person = vrlContext.Persons.FirstOrDefault(x => x.Id == id);
         PersonInput personVM = new PersonInput();
         personVM.Age = person.Age;
         personVM.FirstName = person.FirstName;
         personVM.LastName = person.LastName;
         personVM.Id = person.Id;
         return View("Edit", personVM);
     }
 }