Example #1
0
        public async Task OnGet()
        {
            var contentGenres = await clientHelper.GetAsync("genres");

            var genres = await contentGenres.ReadAsAsync <GenreModel[]>();

            Genres = new SelectList(genres, nameof(GenreModel.GenreId), nameof(GenreModel.Title));

            var content = await clientHelper.GetAsync("movies");

            Movies = await content.ReadAsAsync <MovieModel[]>();
        }
Example #2
0
        public async Task <IActionResult> OnGetSeats(int movieId, int showTimeId)
        {
            var content = await clientHelper.GetAsync($"screens/{movieId}/{showTimeId}");

            Screen = await content.ReadAsAsync <ScreenModel>();

            var contentBookedSeats = await clientHelper.GetAsync($"seats/booked/{movieId}/{showTimeId}");

            var bookedSeats = await contentBookedSeats.ReadAsAsync <SeatModel[]>();

            foreach (var seat in Screen.Seats.Where(s => bookedSeats.Any(bs => bs.SeatId == s.SeatId)))
            {
                seat.IsBooked = true;
            }

            return(Page());
        }
Example #3
0
        public async Task <IActionResult> OnGetMovieDetails(int movieId)
        {
            var content = await clientHelper.GetAsync($"movies/{movieId}");

            Movie = await content.ReadAsAsync <MovieModel>();

            return(Page());
        }