public async Task DeleteSelectedCustomerAsync() { if (SelectedCustomer != null) { SelectedCustomer.Delete(); await unitOfWork.CommitChangesAsync(); await ReloadAsync(); } }
protected void btnDeleteCustomer_Click(object sender, EventArgs e) { if (SelectedCustomer.IsInDatabase) { SelectedCustomer.Delete(); SelectedCustomer = null; } Response.Redirect("Customers.aspx"); }