public dynamic PreviewQuery(string id) { var query = this._queryRepository.GetByAlias(id); if (query == null) { return NotFound(); } var model = new ExtendedQueryModel(); model.MapFrom(query, this._accountRepository.All(), this._queryRepository.All().Select(q => q.Group).Distinct()); model.Link = ApiConfiguration.Current.QueryApiUrl + model.Link.Replace("$$apikey", OperatingAccount.Current(this._accountRepository).ApiKey.ToString()); var webclient = new WebClient(); var response = webclient.DownloadString(model.Link + "&debug=true&showQuery=true&format=json"); var data = Newtonsoft.Json.JsonConvert.DeserializeObject<dynamic>(response); return data; }
public dynamic Get(string id) { var query = (id == "new") ? new Query { ApiKeys = new List<string> { OperatingAccount.Current(_accountRepository).ApiKey } } : this._queryRepository.GetByAlias(id); var model = new ExtendedQueryModel(); model.MapFrom(query, this._accountRepository.All(), this._queryRepository.All().Select(q => q.Group).Distinct()); model.Link = ApiConfiguration.Current.QueryApiUrl + model.Link.Replace("$$apikey", OperatingAccount.Current(this._accountRepository).ApiKey.ToString()); return model; }