public ActionResult DeleteConfirmar(int id) { var ClienteDelete = _clienteApp.ObterPorId(id); _clienteApp.Delete(ClienteDelete); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { var cliente = _clienteAppService.GetById(id); _clienteAppService.Delete(cliente); return(RedirectToAction("Index")); }
private void btnExcluir_Click(object sender, EventArgs e) { if (MessageBox.Show("Tem certeza que deseja excluir?", "Confirmação", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { var idCliente = int.Parse(dgvClientes.CurrentRow.Cells[0].Value.ToString()); _clienteApp.Delete(idCliente); ReloadForm(); } }
public async Task <IActionResult> Delete(Guid guid) { try { await _clienteAppService.Delete(guid); return(Ok()); } catch (System.Exception ex) { return(BadRequest(ex.Message)); } }
public ActionResult Delete(string id) { try { _clienteAppService.Delete(id); _clienteAppService.Save(); return(NoContent()); } catch (Exception) { return(BadRequest()); } }
public ActionResult Delete(int id) { if (!ModelState.IsValid) { return(BadRequest(ModelState.GetErrorResponse())); } var result = _service.Delete(id); if (!result.Success) { return(BadRequest()); } return(Ok()); }
public async Task <IActionResult> DeleteConfirmed(int id) { if (ModelState.IsValid) { var cliente = await _clienteAppService.GetClienteById(id); if (await _clienteAppService.Delete(cliente)) { return(RedirectToAction(nameof(Index))); } else { ModelState.AddModelError("", $"Something went wrong when deleting the record"); } } return(View()); }
public async Task <IActionResult> DeleteConfirmed(Guid id) { var cliente = await _clienteAppService.GetByIdAsync(id); var model = _mapper.Map <ClienteViewModel>(cliente); if (model == null) { return(NotFound()); } await _clienteAppService.Delete(id); if (!OperacaoValida()) { return(View(model)); } TempData["Sucesso"] = "Cliente excluído com sucesso!"; return(RedirectToAction(nameof(Index))); }
public async Task <ActionResult <Response> > DeleteById(int id) { return(Ok(await _clienteAppService.Delete(id))); }
public GenericResult <bool> Delete([FromBody] int id) { return(appService.Delete(id)); }
public void Delete(int id) { _clienteAppService.Delete(id); }