예제 #1
0
        public IActionResult AddNewQuestion()
        {
            var model = new NewQuestionVm()
            {
                Categories = _categoryAndQuestionService.GetCategories()
            };

            return(View(model));
        }
        public int AddQuestion(NewQuestionVm questionVm)
        {
            var question = _mapper.Map <Question>(questionVm);

            _categoryAndQuestionRepo.DeleteCategoryFromFinishedCategories(question.CategoryId);
            var id = _categoryAndQuestionRepo.AddQuestion(question);

            return(id);
        }
예제 #3
0
        public IActionResult AddNewQuestion(NewQuestionVm model)
        {
            var id = _categoryAndQuestionService.AddQuestion(model);

            return(new RedirectResult(Url.Action("ShowNewQuestion", new { Id = id })));
        }