private void MapResultToClinicalSponsorObject(GraphQL.Common.Response.GraphQLResponse result, ClinicalTrialResult <ClinicalSponsor> clinicalTrialResult)
 {
     foreach (var edge in result.Data.sponsors.edges)
     {
         clinicalTrialResult.Items.Add(new ClinicalSponsor()
         {
             Name = edge.node.name
         });
     }
 }
 private static ClinicalTrialResult <ClinicalSponsor> GetClinicalSponsorResultInstance(GraphQL.Common.Response.GraphQLResponse result)
 {
     return(new ClinicalTrialResult <ClinicalSponsor>()
     {
         HasNextPage = result.Data.sponsors.pageInfo.hasNextPage,
         HasPreviousPage = result.Data.sponsors.pageInfo.hasPreviousPage,
         EndCursor = result.Data.sponsors.pageInfo.endCursor,
         StartCursor = result.Data.sponsors.pageInfo.startCursor,
         TotalCount = result.Data.sponsors.totalCount,
         Items = new List <ClinicalSponsor>()
     });
 }
        private static ClinicalTrialResult <ClinicalTrial> GetClinicalTrialResultInstance(GraphQL.Common.Response.GraphQLResponse result)
        {
            var data = result.Data.trials != null ? result.Data.trials : result.Data.baseMatches;

            return(new ClinicalTrialResult <ClinicalTrial>()
            {
                HasNextPage = data.pageInfo.hasNextPage,
                HasPreviousPage = data.pageInfo.hasPreviousPage,
                EndCursor = data.pageInfo.endCursor,
                StartCursor = data.pageInfo.startCursor,
                TotalCount = data.totalCount,
                Items = new List <ClinicalTrial>()
            });
        }
        private void MapResultToClinicalTrialObject(GraphQL.Common.Response.GraphQLResponse result, ClinicalTrialResult <ClinicalTrial> clinicalTrialResult)
        {
            var data = result.Data.trials != null ? result.Data.trials : result.Data.baseMatches;

            foreach (var edge in data.edges)
            {
                var clinicalTrial = new ClinicalTrial()
                {
                    Cursor                      = edge.cursor,
                    Title                       = edge.node.title,
                    Phase                       = edge.node.phase,
                    Gender                      = edge.node.gender,
                    MaximumAge                  = edge.node.maximumAge,
                    MinimumAge                  = edge.node.minimumAge,
                    Description                 = edge.node.description,
                    Criteria                    = edge.node.criteria,
                    Conditions                  = GetListFromTextArray(edge.node.conditions.Value),
                    AgencyClass                 = edge.node.agencyClass,
                    DetailedDescription         = edge.node.detailedDescription,
                    HasExpandedAccess           = edge.node.hasExpandedAccess,
                    HealthyVolunteers           = edge.node.healthyVolunteers,
                    IsFdaRegulated              = edge.node.isFdaRegulated,
                    Keywords                    = GetListFromTextArray(edge.node.keywords.Value),
                    LinkDescription             = edge.node.linkDescription,
                    LinkUrl                     = edge.node.linkUrl,
                    NctId                       = edge.node.nctId,
                    OfficialTitle               = edge.node.officialTitle,
                    OverallContactEmail         = edge.node.overallContactEmail,
                    OverallContactName          = edge.node.overallContactName,
                    OverallContactPhone         = edge.node.overallContactPhone,
                    OverallOfficialAffilitation = edge.node.overallOfficialAffilitation,
                    OverallOfficialName         = edge.node.overallOfficialName,
                    OverallOfficialRole         = edge.node.overallOfficialRole,
                    OverallStatus               = edge.node.overallStatus,
                    Sponsor                     = edge.node.sponsor,
                    StudyType                   = edge.node.studyType,
                    Sites                       = new List <ClinicalTrialSite>()
                };

                int i = 0;
                foreach (var site in edge.node.sites)
                {
                    clinicalTrial.Sites.Add(new ClinicalTrialSite()
                    {
                        Key             = i,
                        City            = site.city,
                        ContactEmail    = site.contactEmail,
                        ContactName     = site.contactName,
                        ContactPhone    = site.contactPhone,
                        ContactPhoneExt = site.contactPhoneExt,
                        Country         = site.country,
                        Facility        = site.facility,
                        Latitude        = site.latitude,
                        Longitude       = site.longitude,
                        State           = site.state,
                        Status          = site.status,
                        Url             = site.url,
                        ZipCode         = site.zipCode,
                    });

                    i++;
                }

                clinicalTrialResult.Items.Add(clinicalTrial);
            }
        }