Example #1
0
        public object Get(GetTechnology request)
        {
            var key = ContentCache.TechnologyKey(request.Slug, clear: request.Reload);

            return(base.Request.ToOptimizedResultUsingCache(ContentCache.Client, key, () =>
            {
                int id;
                var tech = int.TryParse(request.Slug, out id)
                    ? Db.SingleById <Technology>(id)
                    : Db.Single <Technology>(x => x.Slug == request.Slug.ToLower());

                if (tech == null)
                {
                    throw HttpError.NotFound("Tech stack not found");
                }

                var techStacks = Db.Select(Db.From <TechnologyStack>()
                                           .Join <TechnologyChoice>()
                                           .Join <TechnologyChoice, Technology>()
                                           .Where <TechnologyChoice>(x => x.TechnologyId == tech.Id));

                return new GetTechnologyResponse
                {
                    Technology = tech,
                    TechnologyStacks = techStacks
                };
            }));
        }
Example #2
0
        //Cached AutoQuery
        public object Any(FindTechnologies request)
        {
            var key = ContentCache.TechnologyKey(Request.QueryString.ToString(), clear: request.Reload);

            return(base.Request.ToOptimizedResultUsingCache(ContentCache.Client, key, () =>
            {
                var q = AutoQuery.CreateQuery(request, Request.GetRequestParams());
                return AutoQuery.Execute(request, q);
            }));
        }