예제 #1
0
 public ActionResult Edit(ClienteViewModel clienteViewModel)
 {
     if (ModelState.IsValid)
     {
         _clienteApplication.Atualizar(clienteViewModel);
         return(RedirectToAction("Index"));
     }
     return(View(clienteViewModel));
 }
예제 #2
0
        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));
            }
        }