Beispiel #1
0
        public async Task <IActionResult> GetSlide(string presenter, string slug, int number, CancellationToken ct)
        {
            var slide = await _context.Slides
                        .SingleOrDefaultAsync(s => s.Show.Presenter == presenter && s.Show.Slug == slug && s.Number == number, ct)
                        .ConfigureAwait(false);

            return(slide == null?NotFound() : Ok(SlideDto.FromSlide(presenter, slug, slide)));
        }
Beispiel #2
0
        public async Task <IActionResult> GetLatestSlide(string presenter, string slug, CancellationToken ct)
        {
            var slide = await _context.Slides
                        .Where(s => s.Show.Presenter == presenter && s.Show.Slug == slug && s.HasBeenShown)
                        .OrderByDescending(s => s.Number)
                        .Take(1)
                        .SingleOrDefaultAsync(ct)
                        .ConfigureAwait(false);

            return(slide == null?NotFound() : Ok(SlideDto.FromSlide(presenter, slug, slide)));
        }