private MonitorLocation GetMonitorLocation(Location location) { MonitorLocation monitLocation = new MonitorLocation(); //Fill MonitorLocation values monitLocation.ID = location.ID; monitLocation.GUID = location.GUID; monitLocation.Title = location.Title; monitLocation.LongitudeY = location.LongitudeY; monitLocation.LatitudeX = location.LatitudeX; monitLocation.isActive = location.isActive; monitLocation.Status = location.Status; monitLocation.IconID = location.IconID; List<LinkEndpointsLocation> linksEndPoints = db.LinkEndpointsLocations.Where(l => l.LocationID == location.ID).ToList(); List<long> ids = new List<long>(); foreach (LinkEndpointsLocation lnk in linksEndPoints) { ids.Add((long)lnk.EndpointID); } monitLocation.endPoints = db.Endpoints.Where(e => e.ID > 0 && ids.Contains(e.ID)).ToList(); return monitLocation; }
private MonitorLocation GetMonitorLocation(Location location) { MonitorLocation monitLocation = new MonitorLocation(); //Fill MonitorLocation values monitLocation.ID = location.ID; monitLocation.GUID = location.GUID; monitLocation.Title = location.Title; monitLocation.LongitudeY = location.LongitudeY; monitLocation.LatitudeX = location.LatitudeX; monitLocation.isActive = location.isActive; monitLocation.Status = location.Status; monitLocation.IconID = location.IconID; List <LinkEndpointsLocation> linksEndPoints = db.LinkEndpointsLocations.Where(l => l.LocationID == location.ID).ToList(); List <long> ids = new List <long>(); foreach (LinkEndpointsLocation lnk in linksEndPoints) { ids.Add((long)lnk.EndpointID); } monitLocation.endPoints = db.Endpoints.Where(e => e.ID > 0 && ids.Contains(e.ID)).ToList(); return(monitLocation); }