コード例 #1
0
        public IHttpActionResult Get([FromUri] ProgrammeSearchQueryModel queryModel)
        {
            if (!ModelState.IsValid)
            {
                return(this.Error().InvalidParameters("One or more of the required query parameters are missing."));
            }
            if (queryModel == null)
            {
                queryModel = new ProgrammeSearchQueryModel();
            }
            var programmes = _programmeRepository.Search(queryModel);

            var searchModel = new SearchResultModel <ProgrammeNameModel>()
            {
                Items      = programmes.Items.ToList(),
                TotalCount = programmes.TotalCount
            };

            return(Ok(searchModel));
        }