public async Task <SingleGameSessionViewModel> DeletePlayerFromCurrentGameByAdmin(int gameSessionID, string userID, ClaimsPrincipal userAdminGS) { //player (admin) who want to delete player from GS string adminGS = userAdminGS.FindAll(ClaimTypes.NameIdentifier).FirstOrDefault().Value; var currentGameSession = await _db.GameSessions.GetActiveGameSessionByIdAsync(gameSessionID); var admin = _db.Users.GetEventAdmin(currentGameSession).Id; if (adminGS != admin) { var errorMessage = "You are not admin of current Game Session !"; throw new RequestException(HttpStatusCode.BadRequest, errorMessage, LoggingEvents.DeletePlayerFromCurrentGameByAdmin); } else { var gameSesionAppUser = _db.GameSessionApplicationUsers.GetGameSessionAppUser(currentGameSession.ID, userID); await _db.LeaveGameSession(gameSesionAppUser, currentGameSession); _logger.LogInformation(LoggingEvents.DeletePlayerFromCurrentGameByAdmin, "Delete Player From Current Game By Admin is successfully"); var userProfile = await _db.Users.GetUserProfile(userID); await _db.UpdateNumberOfGamesSessionYouWereKickedOut(userProfile); var singleGameSessionAfterJoin = await GetSingleGameSessionAsync(currentGameSession.ID, userAdminGS); return(singleGameSessionAfterJoin); } }