private async void EditCategory_Click(object sender, RoutedEventArgs e) { Button btn = sender as Button; Category category = ListCategory.Where(x => x.CategoryID == int.Parse(btn.Tag.ToString())).ToList().ElementAt(0); var cate = new CategoryDialog(conn, category); cate.Closing += this.UpdateListCategory; await cate.ShowAsync(); }
private async void DeleteCategory_Click(object sender, RoutedEventArgs e) { Button btn = sender as Button; try { conn.DeleteCategory(new Category() { CategoryID = Int32.Parse(btn.Tag.ToString()) }); ListCategory.Where(x => x.CategoryID == int.Parse(btn.Tag.ToString())).ToList().All(i => ListCategory.Remove(i)); } catch { await new MessageDialog("Something wrong !").ShowAsync(); } }