public IActionResult EditQuestionnaire(int questionnaireId) { Questionnaire q = ModMgr.GetQuestionnaire(questionnaireId, false); List <Phase> availablePhases = new List <Phase>(); Phase parentPhase = ProjMgr.GetPhase(q.ParentPhase.Id); List <QuestionnaireQuestion> questions = QqMgr.GetAllByModuleId(questionnaireId).ToList(); foreach (QuestionnaireQuestion question in questions) { question.Answers = QqMgr.GetAnswers(question.Id); } foreach (Phase phase in ProjMgr.GetAllPhases(q.Project.Id).ToList()) { if (ModMgr.GetQuestionnaire(phase.Id, q.Project.Id) == null) { availablePhases.Add(phase); } } q.Project.Phases = availablePhases.ToList(); q.ParentPhase = parentPhase; q.Questions = questions; ViewData["Project"] = q.Project; ViewData["Questionnaire"] = q; return(View()); }
public IActionResult AddQuestionnaire(int projectId) { Project toAddQuestionnaireTo = ProjMgr.GetProject(projectId, true); List <Phase> availablePhases = new List <Phase>(); foreach (Phase phase in ProjMgr.GetAllPhases(projectId).ToList()) { if (ModMgr.GetQuestionnaire(phase.Id, projectId) == null) { availablePhases.Add(phase); } } toAddQuestionnaireTo.Phases = availablePhases.ToList(); ViewData["project"] = toAddQuestionnaireTo; return(View()); }