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);
        }
예제 #2
0
 public void Update(Artist artist)
 {
     this._Context.Entry(artist).State = System.Data.EntityState.Modified;
 }
예제 #3
0
 public void Remove(Artist artist)
 {
     this._Context.Artists.Remove(artist);
 }
예제 #4
0
 public void Add(Artist artist)
 {
     this._Context.Artists.Add(artist);
 }