Beispiel #1
0
        public GetSlidesDto GetSlides(int presentationId, SlideFilter filter)
        {
            var slides = _slideRepository.GetSlides(presentationId, filter);
            var count  = _slideRepository.GetSlidesCount(presentationId);

            return(new GetSlidesDto
            {
                Slides = _mapper.Map <List <SlideDto> >(slides),
                Count = count
            });
        }
        public List <Slide> GetSlides(int presentationId, SlideFilter filter)
        {
            using (var context = GetContext())
            {
                var query = context.Slides
                            .Include(s => s.SlideOptions)
                            .Where(s => s.PresentationId == presentationId);

                query = ApplySlideFilter(query, filter);

                return(_mapper.Map <List <Slide> >(query));
            }
        }
        private IQueryable <SlideEntity> ApplySlideFilter(IQueryable <SlideEntity> entities, SlideFilter filter)
        {
            if (filter?.ItemsToSkip != null)
            {
                entities = entities.Skip(filter.ItemsToSkip.Value)
                           .Take(1);
            }

            return(entities);
        }
        public IActionResult GetSlides([FromRoute] short presentationId, [FromQuery] SlideFilter filter)
        {
            var getSlidesModel = _slideService.GetSlides(presentationId, filter);

            return(Ok(getSlidesModel));
        }