Ejemplo n.º 1
0
        void CommandUpdateExecute(object parameter)
        {
            var           values = (object[])parameter;
            CheckComboBox ccb    = (CheckComboBox)values[0];
            Page          page   = (Page)values[1];

            foreach (MovieNET.Actor actor in listActorMovie)
            {
                id_actors.Add(actor.Id_actor);
            }
            serviceClient.DeleteMovieActors(selectedMovie.Id_movie, id_actors);
            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(MovieDirectorFirstname, MovieDirectorLastname);
            }
            serviceClient.ModifyImage(selectedMovie.Id_image, Image);
            serviceClient.ModifyMovie(selectedMovie.Id_movie, MovieTitle, MovieSynopsys,
                                      new TimeSpan(int.Parse(MovieDurationHour), int.Parse(MovieDurationMin),
                                                   int.Parse(MovieDurationSec)), Id_movitype, Id_director,
                                      selectedMovie.Id_image);
            id_actors.Clear();
            foreach (MovieNET.Actor actor in SelectedActors)
            {
                id_actors.Add(actor.Id_actor);
            }
            serviceClient.AddMovieActors(id_movie, id_actors);
            clearPage();
            Messenger.Default.Send(id_movie);
            Messenger.Default.Send(user_co);
            var PageW = Window.GetWindow(page);

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