public CategoriesViewModel(IManager manager) { this.manager = manager; Categories = new List<CategoryViewModel>(); currentCategory = new CategoryViewModel(new Category(), manager); currentCategory.NotifyUpdate += () => LoadCategories(); }
public ArtistViewModel(Artist artist, IManager manager) { this.artist = artist; this.manager = manager; category = new CategoryViewModel(artist.Category, manager); categories = new List<CategoryViewModel>(); this.SaveCommand = new RelayCommand(o => UpdateArtist()); this.RemoveCommand = new RelayCommand(o => DeleteArtist()); ConfigureValidation(); }
public void LoadCategories() { categories.Clear(); var categoriesList = manager.GetAllCategories(); foreach(var category in categoriesList) { var categ = new CategoryViewModel(category, manager); categories.Add(categ); } Categories = categories; }
private void CategoryVmToCategory(CategoryViewModel vm) { if (vm == null) return; artist.Category = new Category() { Id = vm.Identifier, Label = vm.Name }; }