Beispiel #1
0
        public async Task <LocationSubSearchModel> GetLocationByLogIdAsync(int logId)
        {
            var log = await _context.Logs.Include(l => l.Location)
                      .Where(l => l.LogId == logId).FirstOrDefaultAsync();

            var location       = log == null ? null : log.Location;
            var locationSearch = LocationOperator.SetLocationSubSearchModel(location);

            return(locationSearch);
        }
Beispiel #2
0
        public async Task <LocationSubSearchModel> GetLocationByAlarmIdAsync(int alarmId)
        {
            var alarm = await _context.Alarms
                        .Include(a => a.Location).Where(a => a.AlarmId == alarmId).FirstOrDefaultAsync();

            var location       = alarm == null ? null : alarm.Location;
            var locationSearch = LocationOperator.SetLocationSubSearchModel(location);

            return(locationSearch);
        }
Beispiel #3
0
        public async Task <IEnumerable <LocationSubSearchModel> > GetLocationsByProjectIdAsync(int projectId)
        {
            var queryData = _context.Locations.Where(g => g.ProjectId == projectId);
            var result    = QueryOperate <Location> .Execute(queryData);

            var locations = await result.ToListAsync();

            var locationsSearch = LocationOperator.SetLocationSubSearchModel(locations);

            return(locationsSearch);
        }
Beispiel #4
0
        public async Task <IEnumerable <LocationSubSearchModel> > GetLocationsByGroupIdAsync(int groupId)
        {
            var queryData = _context.GroupLocations
                            .Where(gl => gl.GroupId == groupId)
                            .Select(gl => gl.Location);

            var result = QueryOperate <Location> .Execute(queryData);

            var locations = await result.ToListAsync();

            var locationsSearch = LocationOperator.SetLocationSubSearchModel(locations);

            return(locationsSearch);
        }
Beispiel #5
0
        public async Task <IEnumerable <LocationSubSearchModel> > GetLocationsByUserId(string userId)
        {
            var queryData = _context.UserLocations
                            .Where(u => u.UserId == userId)
                            .Select(u => u.Location);

            var result = QueryOperate <Location> .Execute(queryData);

            var locations = await result.ToListAsync();

            var locationsSearch = LocationOperator.SetLocationSubSearchModel(locations);

            return(locationsSearch);
        }