public Organisation Get(string id)
        {
            var response = _getAssessmentOrgs.GetOrganisationById(id);

            if (response == null)
            {
                throw HttpResponseFactory.RaiseException(HttpStatusCode.NotFound,
                                                         $"No organisation with EpaOrganisationIdentifier {id} found");
            }

            response.Uri = Resolve(response.Id);

            return(response);
        }
Пример #2
0
        public Provider Get(long ukprn)
        {
            var response = _getProviders.GetProviderByUkprn(ukprn);

            if (response == null)
            {
                throw HttpResponseFactory.RaiseException(
                          HttpStatusCode.NotFound,
                          $"No provider with Ukprn {ukprn} found");
            }

            response.Uri = Resolve(response.Ukprn);

            return(response);
        }
Пример #3
0
        public List <FrameworkProviderSearchResultsItemResponse> GetByFrameworkIdAndLocation(int id, double?lat = null,
                                                                                             double?lon         = null, int page = 1)
        {
            // TODO 404 if framework doesn't exists
            var actualPage = _controllerHelper.GetActualPage(page);

            if (lat.HasValue && lon.HasValue)
            {
                return(_getProviders.GetByFrameworkIdAndLocation(id, lat.Value, lon.Value, actualPage));
            }

            throw HttpResponseFactory.RaiseException(
                      HttpStatusCode.BadRequest,
                      "A valid Latitude and Longitude is required");
        }
        public IEnumerable <Organisation> GetByStandardId(string id)
        {
            var response = _getAssessmentOrgs.GetOrganisationsByStandardId(id);

            if (response == null)
            {
                throw HttpResponseFactory.RaiseException(
                          HttpStatusCode.NotFound,
                          $"No organisation with EpaOrganisationIdentifier {id} found");
            }

            response = response.ToList();
            foreach (var organisation in response)
            {
                organisation.Uri = Resolve(organisation.Id);
            }

            return(response);
        }