private async void DeleteOrder(int?obj) { try { dc = new DialogContent() { Content = "Bạn muốn xóa hóa đơn này ?", Tilte = "Thông Báo" }; var dialogYS = new DialogYesNo() { DataContext = dc }; var result = (bool)await DialogHost.Show(dialogYS, DialogHostId); if (result) { if (await oh_repo.Remove((int)obj)) { dc = new DialogContent() { Content = "Xóa Thành Công", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); ListOrder.Remove(ListOrder.SingleOrDefault(t => t.PurID == (int)obj)); } else { dc = new DialogContent() { Content = "Xóa Thất Bại", Tilte = "Thông Báo" }; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } } } catch { dc.Content = "Có Lỗi"; dc.Tilte = "Thông Báo"; dialog = new DialogOk() { DataContext = dc }; DialogHost.CloseDialogCommand.Execute(null, null); await DialogHost.Show(dialog, DialogHostId); } }
public void Remove(OrderItem item) { ListOrder.Remove(item); }