public void Delete(Entities.Bill bill) { string location = string.Format("{0}{1}/{2}", baseURI, "api", "deletebill"); using (HttpClient client = new HttpClient()) { client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); response = client.DeleteAsync(location).Result; } if (response.StatusCode == HttpStatusCode.OK) { } }
public Entities.Bill Post(Entities.Bill bill) { string location = string.Format("{0}{1}", baseURI, "api"); using (HttpClient client = new HttpClient()) { client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); response = client.PostAsJsonAsync(location, bill).Result; } Entities.Bill returnedItem = new Entities.Bill(); if (response.StatusCode == HttpStatusCode.OK) { returnedItem = response.Content.ReadAsAsync <Entities.Bill>().Result; } return(returnedItem); }