public List <GetAllUserActiveGameResult> GetAllUserActiveGames(int userId) { List <GetAllUserActiveGameResult> toReturn = new List <GetAllUserActiveGameResult>(); try { using (var db = new connectionsLinqDataContext()) { toReturn = db.GetAllUserActiveGame(userId).ToList(); return(toReturn); } } catch (Exception) { return(toReturn); } }
public bool HasThisActiveGame(int userId, int roomId, int gameId) { try { using (var db = new connectionsLinqDataContext()) { var allUserGames = db.GetAllUserActiveGame(userId); foreach (var entry in allUserGames) { if (entry.Game_Id == gameId && entry.roomId == roomId) { return(true); } } return(false); } } catch (Exception) { return(false); } }