public ActionResult Create(PersonalInformation personalinformation) { if (ModelState.IsValid) { db.PersonalInformations.Add(personalinformation); db.SaveChanges(); return RedirectToAction("Details"); } ViewBag.GenderId = new SelectList(db.Genders, "Id", "Type", personalinformation.GenderId); ViewBag.MaritalStatusId = new SelectList(db.MaritalStatus, "Id", "Status", personalinformation.MaritalStatusId); ViewBag.UserProfileId = new SelectList(db.UserProfiles, "UserId", "UserName", personalinformation.UserProfileId); return View(personalinformation); }
public ActionResult Edit(PersonalInformation personalinformation) { if (ModelState.IsValid) { db.Entry(personalinformation).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.GenderId = new SelectList(db.Genders, "Id", "Type", personalinformation.GenderId); ViewBag.MaritalStatusId = new SelectList(db.MaritalStatus, "Id", "Status", personalinformation.MaritalStatusId); ViewBag.UserProfileId = new SelectList(db.UserProfiles, "UserId", "UserName", personalinformation.UserProfileId); return View(personalinformation); }