示例#1
0
        public IEnumerable <StandardOrganisationSummary> GetStandardsByOrganisationIdentifier(string organisationId)
        {
            var take    = _queryHelper.GetStandardsByOrganisationIdentifierAmount(organisationId);
            var results =
                _elasticsearchCustomClient.Search <StandardOrganisationDocument>(
                    s =>
                    s.Index(_applicationSettings.AssessmentOrgsIndexAlias)
                    .From(0)
                    .Take(take)
                    .Query(q => + q.Term("documentType", "standardorganisationdocument") && +q.Term(t => t.EpaOrganisationIdentifier.Suffix("keyword"), organisationId)));

            if (results.ApiCall.HttpStatusCode != 200)
            {
                throw new ApplicationException("Failed query standards by organisation id");
            }

            return(_assessmentOrgsMapping.MapToStandardOrganisationsSummary(results.Documents).OrderBy(x => x.StandardCode));
        }