Пример #1
0
        public async Task <IActionResult> GetSlidePartial(string presenter, string slug, int number)
        {
            var(show, slide) =
                await MultiTask.WhenAll(_shows.Get(presenter, slug), _shows.GetSlide(presenter, slug, number));

            if (show == null || (slide == null || !slide.HasBeenShown))
            {
                return(NotFound());
            }

            var slidePartial = new SlidePartial
            {
                Layout = slide.Layout,
                Html   = ProcessSlideHtml(slide.Html),
                Title  = slide.Title
            };

            return(Ok(slidePartial));
        }
Пример #2
0
        public async Task <IActionResult> PresenterView(string handle, string slug, CancellationToken ct)
        {
            var user = User.FindFirst(ShtikClaimTypes.Handle)?.Value;

            if (!handle.Equals(user, StringComparison.OrdinalIgnoreCase))
            {
                return(NotFound());
            }
            var(show, questions) = await MultiTask.WhenAll(_shows.Get(user, slug, ct), _questions.GetQuestionsForShow(user, slug, ct));

            if (show == null)
            {
                return(NotFound());
            }
            var viewModel = new PresenterViewModel
            {
                Show      = show,
                Questions = questions.OrderByDescending(q => q.Time).ToList()
            };

            return(View(viewModel));
        }
Пример #3
0
        public async Task <IActionResult> ShowSlide(string presenter, string slug, int number)
        {
            var(show, slide) =
                await MultiTask.WhenAll(_shows.Get(presenter, slug), _shows.GetSlide(presenter, slug, number));

            if (show == null || (slide == null || !slide.HasBeenShown))
            {
                return(NotFound());
            }

            slide.Html = ProcessSlideHtml(slide.Html);

            var viewModel = new ShowSlideViewModel
            {
                Presenter = presenter,
                Slug      = slug,
                Title     = show.Title,
                Time      = show.Time,
                Place     = show.Place,
                Slide     = slide
            };

            return(View(viewModel));
        }