public ActionResult Create(LanguageProficiency languageproficiency) { if (ModelState.IsValid) { db.LanguageProficiency.Add(languageproficiency); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.LanguageId = new SelectList(db.Languages, "Id", "Name", languageproficiency.LanguageId); return View(languageproficiency); }
public ActionResult Create(LanguageProficiency languageproficiency) { if (ModelState.IsValid) { var membership = (SimpleMembershipProvider)Membership.Provider; int idUser = membership.GetUserId(User.Identity.Name); int id = manager.GetSpecializationId(idUser); languageproficiency.SpecializationId = id; db.LanguageProficiency.Add(languageproficiency); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.LanguageId = new SelectList(db.Languages, "Id", "Name", languageproficiency.LanguageId); ViewBag.SpecializationId = new SelectList(db.Specializations, "Id", "FieldsOfSpecialization", languageproficiency.SpecializationId); return View(languageproficiency); }
public ActionResult Edit(LanguageProficiency languageproficiency) { if (ModelState.IsValid) { db.Entry(languageproficiency).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.LanguageId = new SelectList(db.Languages, "Id", "Name", languageproficiency.LanguageId); ViewBag.SpecializationId = new SelectList(db.Specializations, "Id", "FieldsOfSpecialization", languageproficiency.SpecializationId); return View(languageproficiency); }