public ActionResult Edit(Person person)
 {
     if (TryUpdateModel(person))
     {
         var personFromDb = _db.Query<Person>().Include("District").Single(p => p.Id == person.Id);
         personFromDb.Notes = person.Notes;
         _db.SaveChanges();
         return RedirectToAction("Search", "District", new { DistrictSelectListItem = personFromDb.District.Id, displayOnlyDeletedPersons = false });
     }
     return View(person);
 }
Exemplo n.º 2
0
 public ActionResult Index()
 {
     Person myPerson = new Person {
         PersonId = 1,
         FirstName = "Joe",
         LastName = "Smith",
         BirthDate = DateTime.Parse("25/02/75"),
         HomeAddress = new Address {
             Line1 = "123 North Street",
             Line2 = "West Bridge",
             City = "London",
             Country = "UK",
             PostalCode = "WC2R 1SS"
         },
         IsApproved = true,
         Role = Role.User
     };
     return View(myPerson);
 }