public ActionResult Create(Person person) { if (ModelState.IsValid) { person.Id = Guid.NewGuid(); db.Person.Add(person); db.SaveChanges(); //return RedirectToAction("Index"); return BreadCrum.RedirectToPreviousAction(Session, ControllerName); } ViewBag.CountryId = new SelectList(db.Countries, "Id", "Name", person.CountryId); ViewBag.GenderId = new SelectList(db.Genders, "Id", "Name", person.GenderId); ViewBag.NationalityId = new SelectList(db.Nationalities, "Id", "Name", person.NationalityId); return View(person); }
public ActionResult Edit(Person person) { if (ModelState.IsValid) { db.Entry(person).State = EntityState.Modified; db.SaveChanges(); return BreadCrum.RedirectToPreviousAction(Session, ControllerName); ; } ViewBag.CountryId = new SelectList(db.Countries, "Id", "Name", person.CountryId); ViewBag.GenderId = new SelectList(db.Genders, "Id", "Name", person.GenderId); ViewBag.NationalityId = new SelectList(db.Nationalities, "Id", "Name", person.NationalityId); return View(person); }