Exemplo n.º 1
0
        public void DeleteQuizCorrect()
        {
            var quiz = new Quiz
            {
                Id   = 1,
                Naam = "Quiz 1"
            };

            //Arange
            var unitOfWork = new Mock <ITeamQuizRondeUnitOfWork>();

            unitOfWork.Setup(x => x.QuizRepository.Remove(1)).Returns(true);
            var quizService = new QuizService(unitOfWork.Object);

            //Act
            var quizDTO = new QuizDTO
            {
                Id   = 1,
                Naam = "Quiz 1"
            };

            //Assert
            Assert.IsFalse(quizService.Delete(1).DidError);

            Assert.IsTrue(quizService.FindQuiz(quiz.Id).DidError);
            Assert.IsNull(quizService.FindQuiz(quiz.Id).DTO);
        }
Exemplo n.º 2
0
        // GET: Quiz/Delete/5
        public ActionResult Delete(int id)
        {
            Quiz p;

            p = Ps.GetById(id);
            Ps.Delete(p);
            Ps.Commit();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        public ActionResult DeleteQuiz(int id)
        {
            IQuizService quizService = new QuizService();
            List <int>   idList      = new List <int>();

            idList.Add(id);
            quizService.Delete(idList);
            TempData["message"] = "Quiz " + ((QuizTransfer)Session["quiz"]).QuizDescription.QuizName + " has been deleted successfully.";
            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
 public ActionResult Delete(int id, quiz q)
 {
     try
     {
         // TODO: Add delete logic here
         q = qz.GetById(id);
         qz.Delete(q);
         qz.Commit();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }