public List<Network> GetAll(NetworkFilter filter = null) { using (var context = new DeviceHiveContext()) { return context.Networks.Filter(filter).ToList(); } }
public List<Network> GetByUser(int userId, NetworkFilter filter = null) { using (var context = new DeviceHiveContext()) { return context.Networks.Where(n => context.UserNetworks .Where(un => un.UserID == userId).Select(un => un.NetworkID).Contains(n.ID)) .Filter(filter).ToList(); } }
public List<Network> GetByUser(int userId, NetworkFilter filter = null) { var userNetworks = _mongo.UserNetworks.Find(Query<UserNetwork>.EQ(e => e.UserID, userId)); var networkIds = userNetworks.Select(e => e.NetworkID).Distinct().ToArray(); return _mongo.Networks.AsQueryable().Where(e => networkIds.Contains(e.ID)).Filter(filter).ToList(); }
public List<Network> GetAll(NetworkFilter filter = null) { return _mongo.Networks.AsQueryable().Filter(filter).ToList(); }