public ActionResult AddHint(HintViewModel hint) { if (ModelState.IsValid) { Hint newHint = new Hint() { IdQuestion = hint.IdQuestion, Hint1 = hint.HintDescription }; hintRepository.CreateNewHint(newHint); hintRepository.SaveChanges(); return RedirectToAction("ListHints", "Admin", new { idQuestion = hint.IdQuestion }); } else { return RedirectToAction("AddHint", "Admin"); } }
public ActionResult EditHint(HintViewModel hint) { Hint activeHint = hintRepository.GetHintByID(hint.IdHint); if (activeHint != null && activeHint.Hint1 != null) { activeHint.Hint1 = hint.HintDescription; activeHint.IdQuestion = hint.IdQuestion; hintRepository.SaveChanges(); } return RedirectToAction("ListHints", "Admin", new { idQuestion = hint.IdQuestion }); }