//[HttpPost] public ActionResult DeleteGeneralKnowledge(int id) { if (!user.IsManager()) { return(View("Error")); } else { int id_question = Convert.ToInt32(id); bool del = qdata.DeleteQuestion(id_question); if (del) { TempData["status_id"] = true; TempData["status"] = "Delete complete !"; } else { TempData["status_id"] = false; TempData["status"] = "Error, this question have already in test !!!"; } return(RedirectToAction("GeneralKnowledge")); } }
/// <summary> /// Deletes the question. /// </summary> /// <param name="id">Question's id.</param> /// <returns>Refresh the page.</returns> public async Task <IActionResult> OnPostDeleteAsync(int id) { QuestionData questionData = new QuestionData(_db); DataQuestionModel newQuestionModel = new DataQuestionModel { Question = DisplayQuestion.Question, DomainId = DisplayQuestion.DomainId, Id = DisplayQuestion.Id, QuestionTypeId = DisplayQuestion.QuestionTypeId, }; await questionData.DeleteQuestion(newQuestionModel); return(RedirectToPage("./question")); }