public async Task<ProductCategoryGroupCategoryModel> CreateProductCategoryGroupCategoryAsync(ProductCategoryGroupCategoryModel ProductCategoryGroupCategory) { using (var client = new HttpClient()) { List<KeyValuePair<string, string>> values = HelperMethods.CreateKeyValuePairsFromReflection(ProductCategoryGroupCategory); client.DefaultRequestHeaders.Authorization = HelperMethods.CreateAuthorizationHeader(_apiKey); var content = new FormUrlEncodedContent(values); HttpResponseMessage response = await client.PostAsync(BaseRequestUri, content); string responseString = await response.Content.ReadAsStringAsync(); return JsonConvert.DeserializeObject<ProductCategoryGroupCategoryModel>(responseString); } }
public async Task<ProductCategoryGroupCategoryModel> EditProductCategoryGroupCategoryAsync(ProductCategoryGroupCategoryModel ProductCategoryGroupCategory) { using (var client = new HttpClient()) { List<KeyValuePair<string, string>> values = HelperMethods.CreateKeyValuePairsFromReflection(ProductCategoryGroupCategory); client.DefaultRequestHeaders.Authorization = HelperMethods.CreateAuthorizationHeader(_apiKey); var content = new FormUrlEncodedContent(values); HttpResponseMessage response = await client.PutAsync(BaseRequestUri, content); return await GetProductCategoryGroupCategoryByIdAsync(ProductCategoryGroupCategory.CategoryID); } }