Example #1
0
        void CommandAddExecute(object parameter)
        {
            var           values = (object[])parameter;
            CheckComboBox ccb    = (CheckComboBox)values[0];
            Page          page   = (Page)values[1];

            if (ccb.SelectedItems.Count > 0)
            {
                for (int i = 0; i < ccb.SelectedItems.Count; i++)
                {
                    SelectedActors.Add((MovieNET.Actor)ccb.SelectedItems[i]);
                }
            }
            if (SelectedMovieType.Id_type == 0)
            {
                Id_movitype = serviceClient.CreateMovieType(MovieType);
            }
            if (SelectedDirector.Id_director == 0)
            {
                Id_director = serviceClient.CreateDirector(DirectorFirstname, DirectorLastname);
            }
            Id_image = serviceClient.CreateImage(Image);
            Id_movie = serviceClient.CreateMovie(MovieTitle, MovieSynopsys,
                                                 new TimeSpan(int.Parse(MovieDurationHour), int.Parse(MovieDurationMin),
                                                              int.Parse(MovieDurationSec)), Id_movitype, Id_director, Id_image);
            List <int> id_actors = new List <int>();

            foreach (MovieNET.Actor actor in SelectedActors)
            {
                id_actors.Add(actor.Id_actor);
            }
            serviceClient.AddMovieActors(Id_movie, id_actors);

            Messenger.Default.Send(Id_movie);
            Messenger.Default.Send(User_co);
            clearPage();
            var PageW = Window.GetWindow(page);

            PageW.Content = new View.FilmPage();
        }