private void btnSalvar_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show("Deseja salvar?", "Aviso!", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { this.cliente.Nome = tbNome.Text; this.cliente.Cpf = mtbCPF.Text.Replace("-", ""); this.cliente.Nascimento = dtNascimento.Value; this.cliente.Telefone.Numero = mtbTelefone.Text .Replace("(", "") .Replace(")", "") .Replace("-", ""); try { ClienteService.AtualizarCliente(cliente); MessageBox.Show("Atualizado com sucesso!"); this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public void AtualizarCliente(int idCliente) { using var ctx = new Context(); var atualizarCliente = new ClienteService(); atualizarCliente.AtualizarCliente(ctx, idCliente); }
public void AtualizarCliente(int id, string nome, PorteEmpresa porteEmpresa) { Cliente cliente = _service.ProcurarCliente(id); cliente.Nome = nome; cliente.PorteEmpresa = porteEmpresa; _service.AtualizarCliente(cliente); }
public bool Put([FromBody] Cliente cliente) { try { return(_clienteService.AtualizarCliente(cliente)); } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public IActionResult Atualizar(Cliente cliente, int?id) { if (id == null) { return(NotFound()); } if (ModelState.IsValid) { _service.AtualizarCliente(cliente); return(RedirectToAction(nameof(Index))); } return(View(cliente)); }
public void Put(int id, [FromBody] AtualizarCliente cliente) { _service.AtualizarCliente(id, cliente); }