Ejemplo n.º 1
0
        public ActionResult DeleteConfirmar(int id)
        {
            var ClienteDelete = _clienteApp.ObterPorId(id);

            _clienteApp.Delete(ClienteDelete);
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        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));
            }
        }
Ejemplo n.º 5
0
 public ActionResult Delete(string id)
 {
     try
     {
         _clienteAppService.Delete(id);
         _clienteAppService.Save();
         return(NoContent());
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
Ejemplo n.º 6
0
        public ActionResult Delete(int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.GetErrorResponse()));
            }

            var result = _service.Delete(id);

            if (!result.Success)
            {
                return(BadRequest());
            }

            return(Ok());
        }
Ejemplo n.º 7
0
        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());
        }
Ejemplo n.º 8
0
        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)));
        }
Ejemplo n.º 9
0
 public async Task <ActionResult <Response> > DeleteById(int id)
 {
     return(Ok(await _clienteAppService.Delete(id)));
 }
Ejemplo n.º 10
0
 public GenericResult <bool> Delete([FromBody] int id)
 {
     return(appService.Delete(id));
 }
 public void Delete(int id)
 {
     _clienteAppService.Delete(id);
 }