public IActionResult GetAll([FromServices] IDependenteApplicationService dependenteApplicationService)
 {
     try
     {
         return(Ok(dependenteApplicationService.GetAll()));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e.Message));
     }
 }
 public IActionResult Put(DependenteEdicaoModel model,
                          [FromServices] IDependenteApplicationService dependenteApplicationService)
 {
     try
     {
         dependenteApplicationService.Update(model);
         return(Ok("Dependente Alterado com sucesso."));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e.Message));
     }
 }
 public IActionResult Delete(int id,
                             [FromServices] IDependenteApplicationService dependenteApplicationService)
 {
     try
     {
         dependenteApplicationService.Delete(id);
         return(Ok("Dependente Excluído com sucesso."));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e.Message));
     }
 }
 public IActionResult Post(DependenteCadastroModel model,
                           [FromServices] IDependenteApplicationService dependenteApplicationService)
 {
     try
     {
         dependenteApplicationService.Insert(model);
         return(Ok("Dependente Cadastrado com sucesso."));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e.Message));
     }
 }
 //construtor para fazer funcionar a 'injeção de dependência'
 public DependenteController(IDependenteApplicationService dependenteApplication)
 {
     this.dependenteApplication = dependenteApplication;
 }