コード例 #1
0
 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();
     }
 }
コード例 #2
0
 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();
     }
 }
コード例 #3
0
 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();
     }
 }
コード例 #4
0
 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();
 }
コード例 #5
0
 public List<Device> GetByNetwork(int networkId, DeviceFilter filter = null)
 {
     return _mongo.Devices.AsQueryable().Where(e => e.NetworkID == networkId).Filter(filter).ToList();
 }
コード例 #6
0
 public List<Device> GetAll(DeviceFilter filter = null)
 {
     return _mongo.Devices.AsQueryable().Filter(filter).ToList();
 }