private async Task <JustToBeSafeViewModel> BuildIdentifiedModel(JustToBeSafeViewModel model)
        {
            var pathway = JsonConvert.DeserializeObject <Pathway>(await _restfulHelper.GetAsync(_configuration.GetBusinessApiPathwayIdUrl(model.PathwayNo, model.UserInfo.Demography.Gender, model.UserInfo.Demography.Age)));

            if (pathway == null)
            {
                return(null);
            }

            model.PathwayId         = pathway.Id;
            model.PathwayTitle      = pathway.Title;
            model.PathwayNo         = pathway.PathwayNo;
            model.State             = JourneyViewModelStateBuilder.BuildState(model.UserInfo.Demography.Gender, model.UserInfo.Demography.Age, model.State);
            model.StateJson         = JourneyViewModelStateBuilder.BuildStateJson(model.State);
            model.CollectedKeywords = new KeywordBag(_keywordCollector.ParseKeywords(pathway.Keywords, false).ToList(), _keywordCollector.ParseKeywords(pathway.ExcludeKeywords, false).ToList());
            return(model);
        }
Exemple #2
0
        private async Task <JustToBeSafeViewModel> BuildIdentifiedModel(JustToBeSafeViewModel model)
        {
            var response = await _restClient.ExecuteAsync <Pathway>(new JsonRestRequest(_configuration.GetBusinessApiPathwayIdUrl(model.PathwayNo, model.UserInfo.Demography.Gender, model.UserInfo.Demography.Age), Method.GET));

            CheckResponse(response);

            if (response.Data == null)
            {
                return(null);
            }

            var pathway = response.Data;

            model.PathwayId         = pathway.Id;
            model.PathwayTitle      = pathway.Title;
            model.PathwayNo         = pathway.PathwayNo;
            model.PathwayTraumaType = pathway.TraumaType;
            model.State             = JourneyViewModelStateBuilder.BuildState(model.UserInfo.Demography.Gender, model.UserInfo.Demography.Age, model.State);
            model.StateJson         = JourneyViewModelStateBuilder.BuildStateJson(model.State);
            model.CollectedKeywords = new KeywordBag(_keywordCollector.ParseKeywords(pathway.Keywords, false).ToList(), _keywordCollector.ParseKeywords(pathway.ExcludeKeywords, false).ToList());
            return(model);
        }