コード例 #1
0
        public async Task OnGet()
        {
            ViewData["ApiResult"] = await _downstreamWebApi.CallWebApi();

            // You can also specify the relative endpoint and the scopes
            // ViewData["ApiResult"] = await _downstreamWebApi.CallWebApi("me",
            //                                                             new string[] {"user.read"});
        }
コード例 #2
0
        public async Task <IActionResult> Index()
        {
            ViewData["ApiResult"] = await _downstreamWebApi.CallWebApi();

            // You can also specify the relative endpoint and the scopes
            // ViewData["ApiResult"] = await _downstreamWebApi.CallWebApi("me", new string[] {"user.read"});

            return(View());
        }
コード例 #3
0
        public async Task <IEnumerable <WeatherForecast> > Get()
        {
            HttpContext.VerifyUserHasAnyAcceptedScope(scopeRequiredByApi);

            string downstreamApiResult = await _downstreamWebApi.CallWebApi();

            // You can also specify the relative endpoint and the scopes
            // downstreamApiResult = await _downstreamWebApi.CallWebApi("me", new string[] {"user.read"});

            var rng = new Random();

            return(Enumerable.Range(1, 5).Select(index => new WeatherForecast
            {
                Date = DateTime.Now.AddDays(index),
                TemperatureC = rng.Next(-20, 55),
                Summary = Summaries[rng.Next(Summaries.Length)]
            })
                   .ToArray());
        }