private void View_OnUpdateItem(object sender, IdEventArgs e) { Category item = this.categoryService.GetById(e.Id); if (item == null) { // The item wasn't found this.View.ModelState.AddModelError("", String.Format("Item with id {0} was not found", e.Id)); return; } this.View.TryUpdateModel(item); if (this.View.ModelState.IsValid) { this.categoryService.UpdateCategory(item); } }
private void View_OnDeleteItem(object sender, IdEventArgs e) { this.categoryService.DeleteCategory(e.Id); }