コード例 #1
0
        private async Task GetName()
        {
            var values = await _competitionStatsClient.GetCompetitions();

            CompetitionName = values.AsEnumerable().First(
                kv => kv.Value == CompetitionId).Key;
        }
コード例 #2
0
        public async Task OnPostResult(Result result)
        {
            Result = result;
            if (ModelState.IsValid)
            {
                result.CompetitionId = _competitionStatsClient.GetCompetitions().Result[result.Competition];
                result.TeamId        = _competitionStatsClient.GetTeams().Result[result.Team];
                var json     = Utilities.GetJSON(result);
                var response = await _competitionStatsClient.AddResult(json);

                if (response.StatusCode != System.Net.HttpStatusCode.Created)
                {
                    ModelState.AddModelError("Result.Team", response.ReasonPhrase);
                }
                else
                {
                    Response.Redirect("AddResults");
                }
            }
        }