public ActionResult Create(Applicant applicant) { if (ModelState.IsValid) { db.Applicants.Add(applicant); db.SaveChanges(); return RedirectToAction("Index", applicant.ID); } ViewBag.KnownPL1 = new SelectList(db.PGLanguages, "LanguageName", "LanguageName", applicant.KnownPL1); ViewBag.KnownPL2 = new SelectList(db.PGLanguages, "LanguageName", "LanguageName", applicant.KnownPL2); ViewBag.KnownPL3 = new SelectList(db.PGLanguages, "LanguageName", "LanguageName", applicant.KnownPL3); ViewBag.KnownPL4 = new SelectList(db.PGLanguages, "LanguageName", "LanguageName", applicant.KnownPL4); ViewBag.KnownPL5 = new SelectList(db.PGLanguages, "LanguageName", "LanguageName", applicant.KnownPL5); return View(applicant); }
public ActionResult Edit(Applicant applicant) { if (ModelState.IsValid) { db.Entry(applicant).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.KnownPL1 = new SelectList(db.PGLanguages, "LanguageName", "LanguageName", applicant.KnownPL1); ViewBag.KnownPL2 = new SelectList(db.PGLanguages, "LanguageName", "LanguageName", applicant.KnownPL2); ViewBag.KnownPL3 = new SelectList(db.PGLanguages, "LanguageName", "LanguageName", applicant.KnownPL3); ViewBag.KnownPL4 = new SelectList(db.PGLanguages, "LanguageName", "LanguageName", applicant.KnownPL4); ViewBag.KnownPL5 = new SelectList(db.PGLanguages, "LanguageName", "LanguageName", applicant.KnownPL5); return View(applicant); }