public ActionResult Edit(ClienteViewModel clienteViewModel) { if (ModelState.IsValid) { _clienteApplication.Atualizar(clienteViewModel); return(RedirectToAction("Index")); } return(View(clienteViewModel)); }
public async Task <IHttpActionResult> AtualizarCliente(Cliente cliente) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _clienteApplication.Atualizar(cliente); return(CreatedAtRoute("Default", new { controller = "Cliente", id = cliente.Id }, cliente)); } catch (ApplicationException ex) { return(new BusinessResult(ex.Message, HttpStatusCode.BadRequest)); } catch (Exception ex) { return(new BusinessResult(ex.Message, HttpStatusCode.InternalServerError)); } }