public async Task<ActionResult> EditOption(int option_id, QuestionOption qo) { try { await _mLearningService.UpdateObject<QuestionOption>(qo); return RedirectToAction("EditQuestion", "Quiz", new { question_id = QuestionID }); } catch (Exception e) { Debug.Print(e.Message); } var option = await _mLearningService.GetObjectWithId<QuestionOption>(option_id); QuestionID = option.Question_id; return View("OptionEdit", option); }
public ActionResult DeleteOption(int option_id, QuestionOption todelete) { try { todelete.id = option_id; _mLearningService.DeleteObject<QuestionOption>(todelete); return RedirectToAction("EditQuestion", "Quiz", new { question_id = QuestionID }); } catch { return View("OptionDelete", todelete); } }
public async Task<ActionResult> CreateOption(int question_id, QuestionOption model) { try { model.Question_id = question_id; model.created_at = DateTime.UtcNow; model.updated_at = DateTime.UtcNow; int quizId = await _mLearningService.CreateObject<QuestionOption>(model, q => q.id); return RedirectToAction("EditQuestion", "Quiz", new { question_id = QuestionID }); } catch { return View("OptionCreate"); } }