Exemplo n.º 1
0
        public LocationSearchModel FindById(int locationId)
        {
            var result = _context.Locations.Where(v => v.LocationId == locationId);

            result = (IQueryable <Location>)ExpandOperator.ExpandRelatedEntities <Location>(result);

            var location       = result.FirstOrDefault();
            var locationSearch = LocationOperator.SetLocationSearchModelCascade(location);

            return(locationSearch);
        }
Exemplo n.º 2
0
        public async Task <IEnumerable <LocationSearchModel> > GetAllAsync()
        {
            var queryData = from L in _context.Locations
                            select L;

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

            result = (IQueryable <Location>)ExpandOperator.ExpandRelatedEntities <Location>(result);

            //以下执行完后才会去数据库中查询
            var locations = await result.ToListAsync();

            var locationsSearch = LocationOperator.SetLocationSearchModelCascade(locations);

            return(locationsSearch);
        }