public override void DoDelete() { if (_current == null) { return; } try { if (XtraMessageBox.Show("Il contatto sarà eliminato solamente se nel sistema non ci sono altri riferimenti al contatto. Sicuro di voler procedere? ", "Elimina contatto", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Nested_CheckSecurityForDeletion(); CustomerHandler h = new CustomerHandler(); h.Delete(_current); _mainForm.NavigatorUtility.NavigateToPrevious(); } } catch (AccessDeniedException) { XtraMessageBox.Show("Impossibile accedere alla funzionalità richiesta. Accesso negato", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { ErrorHandler.Show(ex); } }
public JsonResult Delete(int?id) { if (id == null) { return(Json(new { RESULT = "500" })); } var result = _customerHandler.Delete((int)id); if (result.ResponseCode == (int)StatusResponses.Success) { return(Json(new { RESULT = "200" })); } return(Json(new { RESULT = "500" })); }
public async Task <string> Delete(int id) { try { if (await handler.Delete(id)) { Response.StatusCode = 200; return("ok"); } return(null); } catch (HttpException ex) { Response.StatusCode = 400; return(ex.Message); } }