public IActionResult AddQuestionnaireQuestion(int questionnaireId, QuestionnaireQuestion qQ)
        {
            Questionnaire         toAdd       = ModMgr.GetQuestionnaire(questionnaireId, false);
            QuestionnaireQuestion newQuestion = new QuestionnaireQuestion
            {
                QuestionText  = qQ.QuestionText,
                QuestionType  = qQ.QuestionType,
                Module        = toAdd,
                Questionnaire = toAdd,
                Optional      = qQ.Optional,
                Answers       = new List <Answer>()
            };

            toAdd.Questions.Add(qQ);
            QqMgr.MakeQuestion(newQuestion, toAdd.Id);
            ModMgr.EditQuestionnaire(toAdd);

            return(RedirectToAction("AddQuestionnaire", toAdd.Id));
        }
        public IActionResult EditQuestionnaire(EditQuestionnaireModel eqm, int questionnaireid)
        {
            Questionnaire toBeUpdated = ModMgr.GetQuestionnaire(questionnaireid, false);

            Phase  parentPhase        = new Phase();
            String parentPhaseContent = Request.Form["ParentPhase"];

            if (!parentPhaseContent.Equals(""))
            {
                parentPhase        = ProjMgr.GetPhase(Int32.Parse(Request.Form["ParentPhase"].ToString()));
                parentPhase.Module = toBeUpdated;

                Phase previousParent = ProjMgr.GetPhase(toBeUpdated.ParentPhase.Id);
                previousParent.Module = null;


                toBeUpdated.ParentPhase = parentPhase;
                ProjMgr.EditPhase(previousParent);
            }
            else
            {
                parentPhase = toBeUpdated.ParentPhase;
            }

            if (eqm.VoteLevel != null)
            {
                toBeUpdated.VoteLevel = eqm.VoteLevel;
            }

            toBeUpdated.OnGoing = eqm.OnGoing;
            toBeUpdated.Title   = eqm.Title;

            ModMgr.EditQuestionnaire(toBeUpdated);

            return(RedirectToAction("EditQuestionnaire", new { questionnaireId = questionnaireid }));
        }