Esempio n. 1
0
        //[CacheHttpGet(Duration = 3600)]
        public PlaceApiModel GetById(int placeId)
        {
            //System.Threading.Thread.Sleep(2000); // test api latency

            var query = new PlaceById(placeId);
            var entity = _queryProcessor.Execute(query);
            var model = Mapper.Map<PlaceApiModel>(entity);
            return model;
        }
Esempio n. 2
0
        //[CacheHttpGet(Duration = 3600)]
        public IEnumerable<PlaceApiModel> GetChildren(int placeId)
        {
            //System.Threading.Thread.Sleep(5000); // test api latency

            var query = new PlaceById(placeId)
            {
                EagerLoad = new Expression<Func<Place, object>>[]
                {
                    x => x.Children.Select(y => y.GeoPlanetPlace),
                }
            };
            var entity = _queryProcessor.Execute(query);
            var models = Mapper.Map<PlaceApiModel[]>(entity.Children);
            return models;
        }