public bool ModifyManga(Manga manga) { var uri = "https://localhost:44380/api/mangas/" + manga.Id; var content = JsonConvert.SerializeObject(manga); HttpContent httpContent = new StringContent(content, Encoding.UTF8, "application/json"); var resp = _client.PutAsync(uri, httpContent).Result; if (resp.StatusCode == HttpStatusCode.NoContent) { return(true); } return(false); }
public Manga CreateManga(Manga manga) { var uri = "https://localhost:44380/api/mangas"; var content = JsonConvert.SerializeObject(manga); HttpContent httpContent = new StringContent(content, Encoding.UTF8, "application/json"); var resp = _client.PostAsync(uri, httpContent).Result; if (resp.IsSuccessStatusCode) { return(JsonConvert.DeserializeObject <Manga>(resp.Content.ReadAsStringAsync().Result)); } return(null); }