public ArtistEditWindowViewModel() { this.CurrentArtist = new Artist(); this.Artists = new ObservableCollection<Artist>(this._unitOfWork.ArtistRepository.GetArtists()); this.AddCommand = new RelayCommand( _ => { var a = new Artist { Name = this.CurrentArtist.Name }; this._unitOfWork.ArtistRepository.Add(a); this.Artists.Add(a); }, null); this.SaveCommand = new RelayCommand(_ => this._unitOfWork.SaveChanges(), null); }
public void Update(Artist artist) { this._Context.Entry(artist).State = System.Data.EntityState.Modified; }
public void Remove(Artist artist) { this._Context.Artists.Remove(artist); }
public void Add(Artist artist) { this._Context.Artists.Add(artist); }