Esempio n. 1
0
        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());
            }
        }
Esempio n. 2
0
        // GET: Question/Delete/5
        public ActionResult DeleteQuestion(long id)
        {
            QuestionFactory EditQuestion = new QuestionFactory();
            QuestionEntity  topic        = new QuestionEntity();

            topic = EditQuestion.GetQuestionById(id);
            return(View(topic));
        }
Esempio n. 3
0
        public void QuestionFactory()
        {
            IQuestionProvider qf = new QuestionFactory();
            var next             = qf.GetNextQuestion();
            var byId             = qf.GetQuestionById(next.Id);

            Assert.AreEqual(next.Question, byId.Question);
        }
Esempio n. 4
0
 // 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();
     }
 }