Example #1
0
        public void MapToQuestion(Question q)
        {
            q.QuestionText = QuestionText;
            q.TimeTaken = TimeTaken;
            q.Response = Response;

            Probability p;
            Enum.TryParse(Probability, true, out p);
            q.Probability = (int)p;

            Severity s;
            Enum.TryParse(Severity, true, out s);
            q.Severity = (int)s;

            q.SpecialNotes = SpecialNotes;
        }
Example #2
0
 public static QuestionViewModel CreateFromQuestion(Question q, int idx)
 {
     QuestionViewModel questionViewModel = new QuestionViewModel
     {
         QuestionID = q.ID,
         Index = idx.ToString(),
         Delete = false,
         QuestionText = q.QuestionText,
         TimeTaken = q.TimeTaken,
         Response = q.Response,
         Probability = ((Probability)q.Probability).ToString(),
         Severity = ((Severity)q.Severity).ToString(),
         SpecialNotes = q.SpecialNotes,
         QuestionTypeID = q.QuestionType != null ? q.QuestionType.ID : 0,
         QuestionTypeString = q.QuestionType != null ? q.QuestionType.FullName : "",
         TumourGroupID = q.TumourGroup != null ? q.TumourGroup.ID : 0,
         TumourGroupString = q.TumourGroup != null ? q.TumourGroup.FullName : "",
         Keywords = new List<KeywordViewModel>(q.Keywords.Select(k => KeywordViewModel.CreateFromKeyword(k))),
         References = new List<ReferenceViewModel>(q.References.Select(r => ReferenceViewModel.CreateFromReference(r))),
     };
     return questionViewModel;
 }