public async Task <List <string> > SteamIdentitiesToReturn(List <string> userdIds, PavlovServer server, List <SteamIdentity> steamIdentities, bool withInsert = true) { var steamIdentitiesToReturn = new List <string>(); foreach (var newId in userdIds) { var steamIdentity = steamIdentities.FirstOrDefault(x => x.LiteDbUser?.Id == new ObjectId(newId)); if (steamIdentity != null) { var entry = new ServerSelectedMods { PavlovServer = server, LiteDbUser = steamIdentity.LiteDbUser }; if (server.Shack) { steamIdentitiesToReturn.Add(steamIdentity.OculusId); } else { steamIdentitiesToReturn.Add(steamIdentity.Id); } if (withInsert) { await Insert(entry); } } } return(steamIdentitiesToReturn); }
public async Task <int> Insert(ServerSelectedMods serverSelectedMap) { return(await _liteDb.LiteDatabaseAsync.GetCollection <ServerSelectedMods>("ServerSelectedMods") .InsertAsync(serverSelectedMap)); }