public void Update(Quiz entity)
 {
     if (entity != null)
     {
         uow.TestRepository.Update(entity.ToDalTest());
         uow.SaveChanges();
     }
 }
 public void Create(Quiz entity)
 {
     uow.TestRepository.Create(entity.ToDalTest());
     uow.SaveChanges();
 }
        public ActionResult Create(QuizCreateViewModel quiz)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    IEnumerable<QuizQuestion> quizQuestions = quiz.Questions.Select(q => new QuizQuestion()
                    {
                        Text = q.Text,
                        AnswerOptions = q.Answers.Split(';').Where(answer => !string.IsNullOrEmpty(answer)).ToList(),
                        CorrectAnswer = q.CorrectAnswer
                    }).ToList();

                    Quiz newTest = new Quiz() { Title = quiz.Title, Questions = quizQuestions, Category = new QuizCategory() { Name = "Countries", Id = 1 } };
                    quizService.Create(newTest);
                }
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }