public ActionResult Edit(Competency competency) { //save to db. if (ModelState.IsValid) { competenciesRepository.InsertOrUpdate(competency); return(RedirectToAction("Index")); } else { return(View(competency)); } }
public ActionResult Create(Competency competency) { if (ModelState.IsValid) { competenciesRepository.InsertOrUpdate(competency); competenciesRepository.Save(); return(RedirectToAction("Index")); } return(View()); /*var competencyName = competencyHeadersRepository.All.FirstOrDefault(x => x.Name == competencyHeaderName); * * Competency competency = new Competency {Name = name , CompetencyHeaderId = competencyName.CompetencyHeaderId}; * ViewBag.CompetencyHeaderId = new SelectList(competenciesRepository.All, "CompetencyHeaderId", "Name", competency); * return Json(competency); */ }