public void showCinema()
        {
            cinema = getCinema();
            List <ville> list  = listVilles.ChargerVilles();
            List <film>  listF = listFilms.ChargerFilms();


            nom_textbox.Text        = this.cinema.nom;
            list_ville.SelectedItem = this.cinema.ville.nom;
            foreach (ville ville in list)
            {
                list_ville.Items.Add(ville.nom);
            }
            foreach (film f in this.cinema.films)
            {
                film_list.Items.Add(f.titre);
                listFilmsA.Add(f);
            }
            foreach (film film in listF)
            {
                combo_list.Items.Add(film.titre);
            }
            delete_film.IsEnabled = false;
            add_film.IsEnabled    = false;
        }
        public addCinema(gestionCinema w)
        {
            InitializeComponent();

            cinema = new cinema();
            this.w = w;
            start();
        }
        public bool SupprimerCinema(int id)
        {
            cinema cinema = RechercherCinema(id);

            context.cinemas.Remove(cinema);

            return((context.SaveChanges() > 0) ? true : false);
        }
        public bool ModifierCinema(cinema cinema)
        {
            if (cinema == null)
            {
                return(false);
            }

            context.Entry(cinema).State = EntityState.Modified;

            return(context.SaveChanges() > 0);
        }
        public bool SupprimerCinema(cinema cinema)
        {
            if (cinema == null)
            {
                return(false);
            }

            context.cinemas.Remove(cinema);

            return(context.SaveChanges() > 0);
        }
        public cinema AjouterCinema(cinema cinema)
        {
            if (cinema == null)
            {
                return(null);
            }

            context.cinemas.Add(cinema);

            return(context.SaveChanges() > 0 ? cinema : null);
        }
Exemple #7
0
        private void ListViewCinemas_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Delete.IsEnabled = true;
            Edit.IsEnabled   = true;
            cinema cinema = ListViewCinemas.SelectedItem as cinema;

            if (cinema != null)
            {
                Delete.Tag = cinema.id_cinema;
                Edit.Tag   = cinema.id_cinema;
            }
        }
        public cinema RechercherCinema(int id)
        {
            cinema cinema = context.cinemas.Find(id);

            return(cinema ?? null);
        }