private async void GetGameOnList() { var query = ParseObject.GetQuery("GameOn"); var results = await query.FindAsync(); foreach (var result in results) { var gameOn = new GameOn() { Name = result.Get<string>("Name"), ValidUntil = result.Get<DateTime>("ValidUntil") }; _mGameOnList.Add(gameOn); } }
private string SetGameOn(string pUsername) { if (IsUserAlreadyAdded(pUsername)) { _mGameOnList.Find(x => x.Name == pUsername).ValidUntil = DateTime.Now.AddMinutes(20); return "Player was already added."; } var newGameOn = new GameOn() { Name = pUsername, ValidUntil = DateTime.Now.AddMinutes(20) }; _mGameOnList.Add(newGameOn); AddUserToOnlineDb(pUsername); var returnString = string.Format("Player successfully added.\n{0}", GetGameOn()); return returnString; }