public ActionResult Create(EmploymentHistory employmenthistory) { if (ModelState.IsValid) { db.EmploymentHistories.Add(employmenthistory); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.PersonalInfoId = new SelectList(db.PersonalInformations, "Id", "FathersName", employmenthistory.PersonalInfoId); return View(employmenthistory); }
public ActionResult Create(EmploymentHistory employmenthistory) { if (ModelState.IsValid) { var membership = (SimpleMembershipProvider)Membership.Provider; int idUser = membership.GetUserId(User.Identity.Name); int id = manager.GetPersonalInfoIdOfCurrentUser(idUser); employmenthistory.PersonalInfoId = id; db.EmploymentHistories.Add(employmenthistory); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.PersonalInfoId = new SelectList(db.PersonalInformations, "Id", "FirstName", employmenthistory.PersonalInfoId); return View(employmenthistory); }
public ActionResult Edit(EmploymentHistory employmenthistory) { if (ModelState.IsValid) { db.Entry(employmenthistory).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.PersonalInfoId = new SelectList(db.PersonalInformations, "Id", "FathersName", employmenthistory.PersonalInfoId); return View(employmenthistory); }