public List<Device> GetAll(DeviceFilter filter = null) { using (var context = new DeviceHiveContext()) { return context.Devices .Include(e => e.Network) .Include(e => e.DeviceClass.Equipment) .Filter(filter).ToList(); } }
public List<Device> GetByUser(int userId, DeviceFilter filter = null) { using (var context = new DeviceHiveContext()) { return context.Devices .Include(e => e.Network) .Include(e => e.DeviceClass.Equipment) .Where(e => context.UserNetworks.Any(n => n.UserID == userId && n.NetworkID == e.NetworkID)) .Filter(filter).ToList(); } }
public List<Device> GetByNetwork(int networkId, DeviceFilter filter = null) { using (var context = new DeviceHiveContext()) { return context.Devices .Include(e => e.Network) .Include(e => e.DeviceClass.Equipment) .Where(e => e.Network.ID == networkId) .Filter(filter).ToList(); } }
public List<Device> GetByUser(int userId, DeviceFilter filter = null) { var networkIds = _mongo.UserNetworks.AsQueryable().Where(e => e.UserID == userId).Select(e => (int?)e.NetworkID).ToArray(); return _mongo.Devices.AsQueryable().Where(e => networkIds.Contains(e.NetworkID)).Filter(filter).ToList(); }
public List<Device> GetByNetwork(int networkId, DeviceFilter filter = null) { return _mongo.Devices.AsQueryable().Where(e => e.NetworkID == networkId).Filter(filter).ToList(); }
public List<Device> GetAll(DeviceFilter filter = null) { return _mongo.Devices.AsQueryable().Filter(filter).ToList(); }