Example #1
0
        public ActionResult Details(int id)
        {
            var result = Authenticate();

            if (result == 1)
            {
                Film film = filmService.GetFilm(id);
                if (film == null)
                {
                    return(HttpNotFound());
                }
                return(View(film));
            }
            else
            {
                return(View("Error404"));
            }
        }
Example #2
0
        public async void GetFilm_By_ID_Returns_Correct_Film()
        {
            // Arrange
            var    filmService   = new FilmService();
            string id            = "tt0088323";
            string expectedTitle = "The NeverEnding Story";

            // Act
            Film actual = await filmService.GetFilm(id);

            // Assert
            Assert.Equal(actual.Title, expectedTitle);
        }
Example #3
0
        public ActionResult GetShowtimeByShowDate(string showDate, int id, int cinemaId)
        {
            Dictionary <int, int> lstSeats = new Dictionary <int, int>();
            DateTime currentDate           = DateTime.Now;
            Film     film = filmService.GetFilm(id);

            DateTime        date          = DateTime.Parse(showDate);
            List <Showtime> listShowtimes = showtimeService.GetAll().Where(a => a.ShowDate == date && a.FilmId == film.FilmId && a.Room.CinemaId == cinemaId).OrderBy(a => a.Queue).ToList();

            foreach (var item in listShowtimes)
            {
                var seats = seatService.GetAll().Where(n => n.RoomId == item.RoomId).Count() - ticketService.GetAll().Where(n => n.ShowtimeId == item.ShowtimeId).Count();
                lstSeats.Add(item.ShowtimeId, seats);
            }
            ViewBag.Seat = lstSeats;
            return(PartialView("_GetShowtimeByShowDate", listShowtimes));
        }
        public async Task InitializeAsync()
        {
            var filmService = new FilmService();
            var film        = await filmService.GetFilm();

            if (film != null)
            {
                FilmList   = new ObservableCollection <Film>(film);
                FilmDefini = new ObservableCollection <Film>();
                ObservableCollection <int> listIndex = new ObservableCollection <int>();

                foreach (Film filmPropo in FilmList)
                {
                    Film _filmDefinitive = new Film(filmPropo.FilmId, filmPropo.Titre, filmPropo.Description, filmPropo.Duree, filmPropo.DateSortie, filmPropo.Realisateur, filmPropo.AvisDuSite, filmPropo.Categorie);
                    FilmDefini.Add(_filmDefinitive);
                }
                if (Recherche != null)
                {
                    listIndex.Clear();
                    for (int indiceNom = 0; indiceNom < FilmDefini.Count(); indiceNom++)
                    {
                        if (!FilmDefini[indiceNom].Titre.Equals((string)Recherche) && !FilmDefini[indiceNom].Realisateur.Equals((string)Recherche))
                        {
                            listIndex.Add(indiceNom);
                        }
                    }
                    for (int indexNom = listIndex.Count() - 1; indexNom > -1; indexNom--)
                    {
                        FilmDefini.RemoveAt(listIndex[indexNom]);
                    }
                }
                if (FilmDefini.Count() == 0)
                {
                    var dialogue = new Windows.UI.Popups.MessageDialog("Aucun résultat");
                    dialogue.ShowAsync();
                }
            }
            else
            {
                var dialogue = new Windows.UI.Popups.MessageDialog("Problème de connection");
                dialogue.ShowAsync();
            }
        }
 public async Task <ActionResult <Film> > GetFilm(string imdbid)
 {
     return(await _films.GetFilm(imdbid));
 }
Example #6
0
 // GET: ChiTietPhim
 public ActionResult Index(int id)
 {
     return(View(filmService.GetFilm(id)));
 }
        public async Task LoadFilms()
        {
            Films = await _filmService.GetFilm();

            FullFilms = Films;
        }
Example #8
0
 public void OnGet()
 {
     Film = FilmService.GetFilm();
 }