public ActionResult DeleteQuestion(long id, FormCollection collection) { try { QuestionFactory DeleteQuestion = new QuestionFactory(); QuestionEntity Question = new QuestionEntity(); Question = DeleteQuestion.GetQuestionById(id); DataLayer.tblQuestion NewQuestion = new DataLayer.tblQuestion(); NewQuestion.QuestionId = id; NewQuestion.QuizId = Question.QuizId; NewQuestion.Question = Question.Question; NewQuestion.CreatedDate = Question.CreatedDate; NewQuestion.CreatedBy = Question.CreatedBy; NewQuestion.UpdatedDate = DateTime.Now; NewQuestion.UpdatedBy = null; NewQuestion.IsActive = false; // IsActive will be false in delete record DeleteQuestion.SaveQuestion(NewQuestion); return(RedirectToAction("Question")); } catch { return(View()); } }
// GET: Question/Delete/5 public ActionResult DeleteQuestion(long id) { QuestionFactory EditQuestion = new QuestionFactory(); QuestionEntity topic = new QuestionEntity(); topic = EditQuestion.GetQuestionById(id); return(View(topic)); }
public void QuestionFactory() { IQuestionProvider qf = new QuestionFactory(); var next = qf.GetNextQuestion(); var byId = qf.GetQuestionById(next.Id); Assert.AreEqual(next.Question, byId.Question); }
// GET: Question/Edit/5 public ActionResult EditQuestion(long id) { try { QuestionFactory EditQuestion = new QuestionFactory(); QuestionEntity topic = new QuestionEntity(); topic = EditQuestion.GetQuestionById(id); return(View(topic)); } catch { return(View()); } finally { GetQuiz(); } }