public HttpResponseMessage GetItem(Guid id) { HttpResponseMessage H = new HttpResponseMessage(); DataAccess.testSetData data = new DataAccess.testSetData(); List <TestSet.Test_Set> list = new List <TestSet.Test_Set>(); list = data.GetTestSet(id); var collection = list; dynamic collectionWrapper = new { testsets = collection }; var output = JsonConvert.SerializeObject(collectionWrapper); JsonSerializerSettings JSS = new JsonSerializerSettings(); H.Content = new StringContent(output); H.StatusCode = HttpStatusCode.OK; return(H); }
public HttpResponseMessage GetTestSet([FromUri] string TestSetName) { HttpResponseMessage H = new HttpResponseMessage(); DataAccess.testSetData data = new DataAccess.testSetData(); List <TestSet.Test_Set> list = new List <TestSet.Test_Set>(); string parameter = "testset_title"; string query = @"select * from qadata.ref_testset where " + parameter + @" = @EqualsWhat"; list = data.GetTestSet(query, "Varchar", TestSetName); var collection = list; dynamic collectionWrapper = new { testsets = collection }; var output = JsonConvert.SerializeObject(collectionWrapper); JsonSerializerSettings JSS = new JsonSerializerSettings(); H.Content = new StringContent(output); H.StatusCode = HttpStatusCode.OK; return(H); }