Esempio n. 1
0
        public async Task <IActionResult> CreateQuestion(CreateQuestionModel model, int surveyId, int complete)
        {
            if (ModelState.IsValid)
            {
                await _repository.AddQuestionaryAsync(new Questionary
                {
                    Question    = model.Question,
                    RightAnswer = model.RightAnswer,
                    SurveyId    = surveyId
                });

                if (complete == 1)
                {
                    return(RedirectToAction("Edit", "Survey", new { surveyid = surveyId }));
                }
                return(RedirectToAction("CreateQuestion", "Survey", new { surveyid = surveyId }));
            }

            return(View(model));
        }