示例#1
0
        public async Task <CCGModel> GetCCGDetails(string postcode)
        {
            if (!PostCodeFormatValidator.IsAValidPostcode(postcode))
            {
                throw new ArgumentException("Postcode must be valid.");
            }

            postcode = NormalisePostcode(postcode);

            var ccgResult = await _ccgRepository.Get(postcode);

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

            if (string.IsNullOrEmpty(ccgResult.CCGId))
            {
                throw new ArgumentOutOfRangeException("Postcode does not have CCGId specified", new Exception(""));
            }

            var stpResult = await _stpRepository.Get(ccgResult.CCGId);

            return(MapCcgToStp(ccgResult, stpResult));
        }
示例#2
0
        public async Task <CCGDetailsModel> GetDetails(string postcode)
        {
            if (!PostCodeFormatValidator.IsAValidPostcode(postcode))
            {
                throw new ArgumentException("Postcode must be valid.");
            }

            postcode = NormalisePostcode(postcode);

            var ccgResult = await _ccgRepository.Get(postcode);

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

            if (string.IsNullOrEmpty(ccgResult.CCGId))
            {
                throw new ArgumentOutOfRangeException("Postcode does not have CCGId specified", new Exception(""));
            }

            var stpResult = await _stpRepository.Get(ccgResult.CCGId);

            if (stpResult != null && !string.IsNullOrWhiteSpace(stpResult.PharmacyServiceIdWhitelist))
            {
                stpResult.PharmacyServiceIdWhitelist = await AppendNationalWhitelistToGPOutOfHours(stpResult.PharmacyServiceIdWhitelist);
            }

            return(DetailsMap(ccgResult, stpResult));
        }