public IActionResult InativarConta(string contaId)
        {
            try
            {
                var conta = _contaService.RetornaContaApi(contaId);
                if (conta == null)
                {
                    return(NotFound());
                }

                conta.Status = "INATIVE";

                var contaInativa = _contaService.EditarConta(conta);
                return(Ok(true));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
示例#2
0
 public IActionResult Alterar([FromBody] ContaApi model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             var conta = _contaService.EditarConta(model);
             return(Ok(conta.ToApi()));
         }
         catch (Exception ex)
         {
             return(BadRequest(ex.Message));
         }
     }
     return(BadRequest());
 }