public override void Refresh() { base.Refresh(); var categories = _categoryService.GetAll(); SelectedCategories.Clear(); Categories.Clear(); foreach (Category category in categories) { _categoryService.Reload(category); Categories.Add(category); } }
private void Delete(object obj) { foreach (Category selectedCategory in SelectedCategories) { var result = MessageBox.Show($"Are you sure you want to delete '{selectedCategory.Name}' category? All items in this category will be deleted.", "Confirm", MessageBoxButton.YesNo); if (result == MessageBoxResult.No) { continue; } _categoryService.Delete(selectedCategory.Id); OnRecordDeleted <Category>(selectedCategory.Name); } SelectedCategories.Clear(); Refresh(); }