public async Task <ActionResult> AddPlayerToGroup(string playerName, string groupName) { Group group = await _store.GetGroupDetailsAsync(groupName); if (group == null) { _logger.LogWarning("group '{0}' not found", groupName); return(BadRequest()); } Player player = await _store.GetPlayerDetailsAsync(playerName); if (player == null) { _logger.LogWarning("player '{0}' not found", playerName); return(BadRequest()); } await _store.AddPlayerToGroupAsync(group, player); return(NoContent()); }
public async Task <IActionResult> AddPlayerToGroup(string gamertag, string groupName) { Group group = await _store.GetGroupDetailsAsync(groupName); if (group == null) { _logger.LogWarning("group '{0}' not found", groupName); return(this.ValidationFailed(new ErrorDetail("groupName", "group not found"))); } Player player = await _store.GetPlayerDetailsByGamertagAsync(gamertag); if (player == null) { _logger.LogError("player '{0}' not found", gamertag); return(BadRequest()); } await _store.AddPlayerToGroupAsync(group, player); return(NoContent()); }
public async Task <ActionResult> GetGroup(string groupName) { // Call data store var group = await _store.GetGroupDetailsAsync(groupName); if (group == null) { return(NotFound()); } // Format response model var resultModel = new GroupGetResponseModel { Group = group }; // Return result return(Ok(resultModel)); }
public async Task <ActionResult> AddCurrentPlayerToGroup(string groupName) { var gamertag = User.GetGamerTag(); Group group = await _store.GetGroupDetailsAsync(groupName); if (group == null) { _logger.LogWarning("group '{0}' not found", groupName); return(NotFound()); } Player player = await _store.GetPlayerDetailsByGamertagAsync(gamertag); if (player == null) { _logger.LogError("player '{0}' not found", gamertag); return(BadRequest()); } await _store.AddPlayerToGroupAsync(group, player); return(NoContent()); }