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