public EditGenreViewModel(Genre genre) { this.Genre = genre; this.Name = genre.Name; EditGenre = new SimpleCommand <object>((object ignored) => { Genre.Edit(Name); RaiseFinished(); }, (object ignored) => !string.IsNullOrWhiteSpace(Name)); PropertyChanged += (object sender, PropertyChangedEventArgs args) => EditGenre.RaiseCanExecuteChanged(); }
public CreateGenreViewModel(Database database) { this._database = database; AddGenre = new SimpleCommand <object>((ignored) => { database.AddGenre(new Genre(Name)); RaiseFinished(); }, (ignored) => !string.IsNullOrWhiteSpace(Name)); PropertyChanged += (sender, prop) => AddGenre.RaiseCanExecuteChanged(); }
public CreateActorViewModel(Database database) { this._database = database; AddActor = new SimpleCommand <object>((object ignored) => { database.AddActor(new Actor(FirstName, LastName)); RaiseFinished(); }, (object ignored) => !string.IsNullOrWhiteSpace(FirstName) && !string.IsNullOrWhiteSpace(LastName)); PropertyChanged += (object sender, PropertyChangedEventArgs args) => AddActor.RaiseCanExecuteChanged(); }
public EditActorViewModel(Actor actor) { this.Actor = actor; this.FirstName = actor.FirstName; this.LastName = actor.LastName; EditActor = new SimpleCommand <object>((object ignored) => { Actor.Edit(FirstName, LastName); RaiseFinished(); }, (object ignored) => !string.IsNullOrWhiteSpace(FirstName) && !string.IsNullOrWhiteSpace(LastName)); PropertyChanged += (object sender, PropertyChangedEventArgs args) => EditActor.RaiseCanExecuteChanged(); }
public CreateMovieViewModel(Database database) { this._database = database; AddMovie = new SimpleCommand <object>((ignored) => { database.AddMovie(new Movie(Title, ReleaseDate, Actor, Genre)); RaiseFinished(); }, (ignored) => !string.IsNullOrWhiteSpace(Title) && ReleaseDate != null && Actor != null && Genre != null); PropertyChanged += (sender, prop) => AddMovie.RaiseCanExecuteChanged(); }
public EditMovieViewModel(Movie movie, Database database) { this._database = database; this.Movie = movie; this.Title = movie.Title; this.ReleaseDate = movie.ReleaseDate; this.Actor = movie.Actor; this.Genre = movie.Genre; EditMovie = new SimpleCommand <object>((object ignored) => { Movie.Edit(Title, ReleaseDate, Actor, Genre); RaiseFinished(); }, (object ignored) => !string.IsNullOrWhiteSpace(Title) && ReleaseDate != null && Actor != null && Genre != null); PropertyChanged += (object sender, PropertyChangedEventArgs args) => EditMovie.RaiseCanExecuteChanged(); }