public IActionResult Insert(
            [FromBody] TaxaSelicInsertCommand command,
            [FromServices] TaxaSelicService service
            )
        {
            GenericResult result = service.Exec(command);

            return(StatusCode(result.Status, result));
        }
        public IActionResult Update(
            [FromBody] TaxaSelicUpdateCommand command,
            [FromServices] TaxaSelicService service,
            [FromServices] IMemoryCache cache
            )
        {
            GenericResult result = service.Exec(command);

            if (result.Status == 200)
            {
                cache.Remove(command.Id);
            }

            return(StatusCode(result.Status, result));
        }
        public IActionResult Delete(
            int id,
            [FromServices] TaxaSelicService service,
            [FromServices] IMemoryCache cache
            )
        {
            TaxaSelicDeleteCommand command = new TaxaSelicDeleteCommand(id);

            GenericResult result = service.Exec(command);

            if (result.Status == 204)
            {
                cache.Remove(id);
            }

            return(StatusCode(result.Status, result));
        }
        public GenericPesquisa GetAll(
            short pagina,
            short qtd,
            string campo,
            short ordem,
            [FromServices] TaxaSelicService service,
            string filtro = ""
            )
        {
            Pesquisa pesquisa = new Pesquisa(pagina, qtd, campo, ordem, filtro);

            GenericPesquisa result = new GenericPesquisa(
                service.GetAll(pesquisa),
                service.GetTotalDeRegistros(pesquisa)
                );

            return(result);
        }
        public TaxaSelicModel GetByIdExterno(
            int id,
            [FromServices] TaxaSelicService service,
            [FromServices] IMemoryCache cache
            )
        {
            TaxaSelicModel taxaSelicModel;

            if (!cache.TryGetValue(id, out taxaSelicModel))
            {
                taxaSelicModel = service.GetById(id, "");

                if (taxaSelicModel != null)
                {
                    var opcoesDoCache = new MemoryCacheEntryOptions()
                    {
                        AbsoluteExpiration = DateTime.Now.AddMinutes(CACHEEMMINUTOS)
                    };
                    cache.Set(id, taxaSelicModel, opcoesDoCache);
                }
            }

            return(taxaSelicModel);
        }