public async Task<Tuple<string, JourneyViewModel>> BuildNextAction(List<QuestionWithAnswers> questions, Journey journey, JustToBeSafeViewModel model, Answer selectedAnswer, QuestionWithAnswers selectedQuestion, string questionsJson) { if (!questions.Any()) { journey.Steps = journey.Steps.Where(step => step.QuestionId != model.SelectedQuestionId).ToList(); var journeyViewModel = new JourneyViewModel { PathwayId = model.PathwayId, PathwayNo = model.PathwayNo, PathwayTitle = model.PathwayTitle, SymptomDiscriminator = model.SymptomDiscriminator, UserInfo = model.UserInfo, JourneyJson = JsonConvert.SerializeObject(journey), SelectedAnswer = JsonConvert.SerializeObject(selectedAnswer), }; _mappingEngine.Map(selectedQuestion, journeyViewModel); journeyViewModel = _mappingEngine.Map(selectedAnswer, journeyViewModel); return await _questionViewModelBuilder.BuildQuestion(journeyViewModel); } if (questions.Count() == 1) { var journeyViewModel = new JourneyViewModel { PathwayId = model.PathwayId, PathwayNo = model.PathwayNo, PathwayTitle = model.PathwayTitle, UserInfo = model.UserInfo, JourneyJson = JsonConvert.SerializeObject(journey), }; _mappingEngine.Map(questions.First(), journeyViewModel); journeyViewModel = _mappingEngine.Map(selectedAnswer, journeyViewModel); return new Tuple<string, JourneyViewModel>("../Question/Question", journeyViewModel); } var viewModel = new JustToBeSafeViewModel { PathwayId = model.PathwayId, PathwayNo = model.PathwayNo, PathwayTitle = model.PathwayTitle, JourneyJson = JsonConvert.SerializeObject(journey), SymptomDiscriminator = selectedAnswer.SymptomDiscriminator ?? model.SymptomDiscriminator, Part = model.Part + 1, Questions = questions, QuestionsJson = questionsJson, UserInfo = model.UserInfo }; return new Tuple<string, JourneyViewModel>("JustToBeSafe", viewModel); }
public Journey Add(Journey otherJourney) { otherJourney.Steps.ForEach(step => Steps.Add(step)); return this; }
public Journey Add(Journey otherJourney) { otherJourney.Steps.ForEach(step => Steps.Add(step)); return(this); }