Пример #1
0
        public IHttpActionResult GetChapter(string courseCode)
        {
            try
            {
                IQueryable <Chapter> chapters = _chapterService.Search(_ => _.CourseCode == courseCode).OrderBy(x => x.Order);

                return(Ok(ModelBuilder.ConvertChapters(chapters)));
            }
            catch (Exception ex)
            {
                _loggingService.Write(ex);
                return(InternalServerError(ex));
            }
        }
        public IHttpActionResult GetChapters(IEnumerable <int> idList)
        {
            if (idList == null)
            {
                return(BadRequest());
            }
            try
            {
                IQueryable <Chapter> chapters = _chapterService.Search(_ => idList.Contains(_.Id));

                return(Ok(ModelBuilder.ConvertChapters(chapters)));
            }
            catch (Exception ex)
            {
                _loggingService.Write(ex);
                return(InternalServerError(ex));
            }
        }