예제 #1
0
        public async Task <IActionResult> OnGetAsync(string id)
        {
            if (id == null)
            {
                CurrentUser = await _userManager.GetUserAsync(User);
            }
            else
            {
                HttpClient  httpclient = _clientFactory.CreateClient();
                UsersClient client     = new UsersClient(httpclient);
                try
                {
                    CurrentUser = await client.GetAsync(id);
                }
                catch
                {
                    CurrentUser = null;
                }

                try
                {
                    StatisticsClient sscli = new StatisticsClient(httpclient);
                    Statistics = await sscli.GetUserAsync(id);
                }
                catch
                {
                    Statistics = null;
                }
            }

            if (CurrentUser == null)
            {
                return(NotFound($"Unable to load user with ID '{id ?? _userManager.GetUserId(User)}'."));
            }

            return(Page());
        }