Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var connectionOptions = new ConnectionOptions(
                "https://city-rates.documents.azure.com:443/",
                "PERNkHuRBu1W9e9oeIznbqZZ6PUDg9OOxp31pIxRfc0gw52p5GRvPo0bToNGTtoN5CQgGPC5Y3b2nDfIyMnMJg==",
                "CityRatesDB",
                "BelagroprombankCollection"
                );

            var belagroprombankRepo = new BelagroprombankRepository(connectionOptions);

            belagroprombankRepo.GetGlobalCurrencies();
            //var belagroprombankService = new BelagroprombankService(belagroprombankRepo);
            //belagroprombankService.UpdateBelagroprombankInfo();

            var belRepo = new BelarusbankRepository(connectionOptions);

            belRepo.UpdateBelarusbankInfo();
            //var connectionOptions = new ConnectionOptions(
            //    "https://city-rates.documents.azure.com:443/",
            //    "PERNkHuRBu1W9e9oeIznbqZZ6PUDg9OOxp31pIxRfc0gw52p5GRvPo0bToNGTtoN5CQgGPC5Y3b2nDfIyMnMJg==",
            //    "CityRatesDB",
            //    "BelarusbankCollection"
            //);

            //var belarusbankRepository = new BelarusbankRepository(connectionOptions);
            //belarusbankRepository.GetGlobalCurrencies();

            //var belarusbankService = new BelarusbankService(belarusbankRepository);
            //var result = belarusbankService.UpdateBelarusbankInfo();

            //var nationalBankRepository = new NationalBankRepository();
            //var nationalBankService = new NationalBankService(nationalBankRepository);
            //nationalBankService.GetNBRates();
        }
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req,
            ILogger log)
        {
            log.LogInformation("C# HTTP trigger function processed a request.");

            string belagroprombank = "";

            string  requestBody = await new StreamReader(req.Body).ReadToEndAsync();
            dynamic data        = JsonConvert.DeserializeObject(requestBody);

            List <int> belagropromankDepartmentsIdList = JsonConvert.DeserializeObject <List <int> >(data?.belagroprombank.ToString());

            var connectionOptions = new ConnectionOptions(
                "https://city-rates.documents.azure.com:443/",
                "PERNkHuRBu1W9e9oeIznbqZZ6PUDg9OOxp31pIxRfc0gw52p5GRvPo0bToNGTtoN5CQgGPC5Y3b2nDfIyMnMJg==",
                "CityRatesDB",
                "BelagroprombankCollection"
                );

            var belagroprombankRepo    = new BelagroprombankRepository(connectionOptions);
            var belagroprombankService = new BelagroprombankService(belagroprombankRepo);
            var result = belagroprombankService.GetFavoriteDepartments(belagropromankDepartmentsIdList);


            return(new OkObjectResult(result));
        }
Exemplo n.º 3
0
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req,
            ILogger log)
        {
            var connectionOptions = new ConnectionOptions(
                "https://city-rates.documents.azure.com:443/",
                "PERNkHuRBu1W9e9oeIznbqZZ6PUDg9OOxp31pIxRfc0gw52p5GRvPo0bToNGTtoN5CQgGPC5Y3b2nDfIyMnMJg==",
                "CityRatesDB",
                "BelagroprombankCollection"
                );

            var belagroprombankRepo    = new BelagroprombankRepository(connectionOptions);
            var belagroprombankService = new BelagroprombankService(belagroprombankRepo);
            var result = belagroprombankService.UpdateBelagroprombankInfo();

            return(new OkObjectResult(result));
        }