private async Task ExecuteGetLeaderboardCommand() { if (IsBusy) { return; } IsBusy = true; try { var items = await azureService.GetScores(CurrentGameType); ScoreItems.Clear(); int i = 1; foreach (var item in items) { item.Number = i; ScoreItems.Add(item); i++; } } finally { IsBusy = false; } }
public IActionResult Create([FromBasicAuth] string auth, [FromBody] ScoreItem item) { if (item == null) { return(BadRequest()); } if (!Auth.IsAllowed(auth, item.Game, UserPermission.PostScores)) { return(Auth.Result); } if (GameItems.Find(item.Game) == null) { return(BadRequest("Game not found")); } item.Date = DateTime.Now; ScoreItems.Add(item); return(CreatedAtRoute("GetScore", new { id = item.Key }, item)); }