public BioService.LocationList Update(BioService.LocationList proto) { BioService.LocationList locations = new BioService.LocationList(); foreach (BioService.Location curProto in proto.Locations) { BioService.Location updatedProto = Update(curProto); if (updatedProto != null) locations.Locations.Add(updatedProto); } return locations; }
public BioService.LocationList Select( BioService.CommandLocations command) { BioService.LocationList result = new BioService.LocationList(); DbSet<Location> locations = _locations.Select(); DbSet<AccessDevice> accessDevices = _accessDevices.Select(); DbSet<CaptureDevice> captureDevices = _captureDevices.Select(); foreach (Location location in locations) { BioService.Location protoLocation = _convertor.GetLocationProto(location); if (protoLocation == null) continue; long locationid = location.Id; IQueryable<AccessDevice> locationAccessDevices = accessDevices.Where(x => x.Location_Id == locationid); foreach (AccessDevice ac in locationAccessDevices) { BioService.AccessDevice currentAccessDeviceProto = _convertor.GetAccessDeviceProto(ac); if (currentAccessDeviceProto != null) protoLocation.AccessDevices.Add(currentAccessDeviceProto); } IQueryable<CaptureDevice> locationCaptureDevices = captureDevices.Where(x => x.Location_Id == locationid); foreach (CaptureDevice ac in locationCaptureDevices) { BioService.CaptureDevice currentCaptureDeviceProto = _convertor.GetCaptureDeviceProto(ac); if (currentCaptureDeviceProto != null) protoLocation.CaptureDevices.Add(currentCaptureDeviceProto); } result.Locations.Add(protoLocation); } return result; }