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 }; })); }
public object Get(GetTechnology request) { if (string.IsNullOrEmpty(request.Slug)) { throw new ArgumentNullException(nameof(request.Slug)); } var tech = int.TryParse(request.Slug, out var 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) .OrderByDescending(x => x.LastModified)); return(new GetTechnologyResponse { Technology = tech, TechnologyStacks = techStacks }); }
public async Task Can_proxy_to_techstacks_Async() { var client = new JsonServiceClient(ListeningOn.CombineWith("techstacks")); var request = new GetTechnology { Slug = "ServiceStack" }; var response = await client.GetAsync(request); Assert.That(response.Technology.VendorUrl, Is.EqualTo("https://servicestack.net")); }
public object Any(GetTechnology request) => new GetTechnologyResponse();