public static IActionResult Run(
     [HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req,
     ILogger log)
 {
     log.LogInformation("Function Cotacoes - HTTP GET");
     return(new OkObjectResult(CotacoesRepository.GetAll()));
 }
Exemplo n.º 2
0
 public IActionResult Run(
     [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req,
     ILogger log)
 {
     log.LogInformation("Function Historico - HTTP GET");
     return(new OkObjectResult(_repository.GetAll()));
 }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Carregando configurações...");
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile($"appsettings.json");
            var configuration = builder.Build();

            DateTime dataHoraExtracao    = DateTime.Now;
            var      excelConfigurations = new ExcelConfigurations();

            new ConfigureFromConfigurationOptions <ExcelConfigurations>(
                configuration.GetSection("ExcelConfigurations"))
            .Configure(excelConfigurations);

            Console.WriteLine("Gerando o arquivo .xlsx (Excel) com as cotações...");

            string arquivoXlsx = ArquivoExcelCotacoes.GerarArquivo(
                excelConfigurations, dataHoraExtracao,
                CotacoesRepository.GetAll());

            Console.WriteLine($"O arquivo {arquivoXlsx} foi gerado com sucesso!");
        }