public async Task <IActionResult> Create(QuestionnaireClass newTitle)
        {
            if (ModelState.IsValid)
            {
                _db.Add(newTitle);
                await _db.SaveChangesAsync();

                return(RedirectToAction("Index", new { id = newTitle.topic_id }));
            }
            return(View(newTitle));
        }
        public async Task <IActionResult> Create(TopicClass newTopic)
        {
            if (ModelState.IsValid)
            {
                _db.Add(newTopic);
                await _db.SaveChangesAsync();

                return(RedirectToAction("Topics"));
            }
            return(View(newTopic));
        }
        public async Task <IActionResult> Create(AnswerClass ans)
        {
            if (ModelState.IsValid)
            {
                _db.Add(ans);
                await _db.SaveChangesAsync();

                //return RedirectToAction("Index");
                return(RedirectToAction("Questionnaire", "Index", new { id = 2 }));
            }
            return(View(ans));
        }
        public async Task <IActionResult> Create(QuestionClass newQuestion)
        {
            if (ModelState.IsValid)
            {
                _db.Add(newQuestion);
                var resetAnswers = _db.Answers.Where(x => x.questionnaire_Id == newQuestion.questionnaire_id).ToList();
                foreach (var rm in resetAnswers)
                {
                    _db.Answers.Remove(rm);
                }

                await _db.SaveChangesAsync();

                return(RedirectToAction("Index", new { id = newQuestion.questionnaire_id }));
            }
            return(View(newQuestion));
        }