public ActionResult <Query> JsonPost() { var queryString = Request.QueryString.Value; if (queryString == "") { return(BadRequest()); } var parsedQueryString = HttpUtility.ParseQueryString(queryString); List <QuerySpec> specsList = new List <QuerySpec>(); for (int i = 0; i < parsedQueryString.Count; i++) { specsList.Add(new QuerySpec(parsedQueryString.GetKey(i), parsedQueryString.GetValues(i)[0])); } Query theQuery = new Query( Utilities.sha256_hash(queryString), specsList ); Query savedQuery = _queryService.Create(theQuery); return(Ok(savedQuery.oid)); }
public HttpResponseMessage Create(Query data) { return(WrapInTryCatch(() => { if (!_modelValidationService.IsValidModel(data)) { throw new ArgumentNullException(); } _queryService.Create(_modelConversionService.ConvertToRepositoryModel(data)); return new HttpResponseMessage(HttpStatusCode.Created); })); }