Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }