public async Task <IEnumerable <CabinetSummaryDto> > GetCabinet()
        {
            List <Cabinet> cabinetsFromDb;

            cabinetsFromDb = await GovLookupRepository.GetAllCabinet();

            return(mapper.Map <IEnumerable <CabinetSummaryDto> >(cabinetsFromDb));
        }
        public async Task <CabinetDetailDto> GetCabinetById(string id)
        {
            var cabinetFromDb = await GovLookupRepository.GetCabinetById(id);

            cabinetFromDb = await AddCabinetData(cabinetFromDb);

            return(mapper.Map <CabinetDetailDto>(cabinetFromDb));
        }
Example #3
0
        public async Task <JudiciaryDetailDto> GetJudiciaryById(string id)
        {
            var judiciaryFromDb = await GovLookupRepository.GetJudiciaryById(id);

            judiciaryFromDb = await AddJudiciaryData(judiciaryFromDb);

            return(mapper.Map <JudiciaryDetailDto>(judiciaryFromDb));
        }
Example #4
0
        public async Task <IEnumerable <CurrentBillsDto> > GetCurrentBills()
        {
            List <CurrentBills> currentBillFromDb;

            currentBillFromDb = await GovLookupRepository.GetCurrentBills();

            return(mapper.Map <IEnumerable <CurrentBillsDto> >(currentBillFromDb));
        }
Example #5
0
        public async Task <IEnumerable <JudiciarySummaryDto> > GetJudiciary()
        {
            List <Judiciary> judiciarysFromDb;

            judiciarysFromDb = await GovLookupRepository.GetAllJudiciary();

            return(mapper.Map <IEnumerable <JudiciarySummaryDto> >(judiciarysFromDb));
        }
Example #6
0
        public async Task <LegislatorDetailDto> GetLegislatorById(string id)
        {
            var legislatorFromDb = await GovLookupRepository.GetLegislatorById(id);

            legislatorFromDb = await AddLegislatorData(legislatorFromDb);

            return(mapper.Map <LegislatorDetailDto>(legislatorFromDb));
        }
        private async Task <Cabinet> AddCabinetData(Cabinet cabinet)
        {
            if (cabinet == null)
            {
                return(cabinet);
            }

            cabinet.Education = await GovLookupRepository.GetCabinetEducation(cabinet.Id);

            cabinet.JobHistory = await GovLookupRepository.GetCabinetJobHistory(cabinet.Id);

            return(cabinet);
        }
Example #8
0
        public async Task <IEnumerable <LegislatorSummaryDto> > GetLegislators(string searchValue)
        {
            List <Legislator> legislatorsFromDb;

            if (string.IsNullOrWhiteSpace(searchValue))
            {
                legislatorsFromDb = await GovLookupRepository.GetAllLegislators();
            }
            else
            {
                legislatorsFromDb = await GetLegislatorsBySearchValue(searchValue);
            }
            return(mapper.Map <IEnumerable <LegislatorSummaryDto> >(legislatorsFromDb));
        }
Example #9
0
        public async Task <List <Legislator> > GetLegislatorsByAddress(string searchValue)
        {
            AddressDetails ar = await GetAddressDetails(searchValue);

            if (ar != null)
            {
                if (ar.result.addressMatches.Count == 0)
                {
                    return(null);
                }
                AddressCorrdinates ac = GetAddressCoordinates(ar);
                if (ac != null)
                {
                    return(await GovLookupRepository.GetLegislatorsByLngLat(ac.longitude, ac.latitude));
                }
            }
            return(null);
        }
Example #10
0
        // serach value could be a name, address or zipcode.
        public async Task <List <Legislator> > GetLegislatorsBySearchValue(string searchValue)
        {
            if (IsValidZip(ref searchValue))
            {
                return(await GovLookupRepository.GetLegislatorsByZipcode(searchValue));
            }
            else
            {
                var legislatorsFromDb = await GetLegislatorsByAddress(searchValue);

                if (legislatorsFromDb != null)
                {
                    return(legislatorsFromDb);
                }
                else
                {
                    return(await GovLookupRepository.GetLegislatorsByName(searchValue));
                }
            }
        }
Example #11
0
        private async Task <Judiciary> AddJudiciaryData(Judiciary judiciary)
        {
            if (judiciary == null)
            {
                return(judiciary);
            }


            judiciary.KeyDecisions = await GovLookupRepository.GetJudiciaryKeyDecisions(judiciary.Id);

            if (judiciary.KeyDecisions != null)
            {
                foreach (KeyDecisions decision in judiciary.KeyDecisions)
                {
                    decision.RollCallDecision = await GovLookupRepository.GetJudiciaryRollCallDecision(decision.Docket);
                }
            }
            judiciary.KeyDecisionsOpinions = await GovLookupRepository.GetJudiciaryKeyDecisionsOpinions(judiciary.Id);

            return(judiciary);
        }
Example #12
0
        private async Task <Legislator> AddLegislatorData(Legislator legislator)
        {
            if (legislator == null)
            {
                return(legislator);
            }

            legislator.Ratings = await GovLookupRepository.GetLegislatorRatings(legislator.Id);

            legislator.KeyVotes = await GovLookupRepository.GetLegislatorKeyVotes(legislator.Id);

            legislator.Bills = await GovLookupRepository.GetLegislatorBills(legislator.Id);

            legislator.Committees = await GovLookupRepository.GetLegislatorCommittees(legislator.Id);

            legislator.IndustryFinance = await GovLookupRepository.GetLegislatorIndustryFinance(legislator.Id);

            var industryFinanceData = await GovLookupRepository.GetLegislatorIndustryFinance(legislator.Id);

            legislator.IndustryFinanceChart        = MapToPieChart(industryFinanceData);
            legislator.IndustryFinanceChartOptions = GetIndustryFinanceChartOptions();
            return(legislator);
        }