Example #1
0
        public async Task <LibraryAccount> AddLibraryAccount(LibraryAccount libraryAccount)
        {
            var jsonString = JsonConvert.SerializeObject(libraryAccount);
            var content    = new StringContent(jsonString, Encoding.UTF8, "application/json");
            var response   = await httpClient.PostAsync("/api/LibraryAccounts", content);

            var code   = response.StatusCode;
            var result = responseReader.ReadObjectAsync <LibraryAccount>(response);

            if (code == (HttpStatusCode)200)
            {
                return(await result);
            }
            return(null);
        }
Example #2
0
        public async Task <Book> AddBook(Book book)
        {
            var jsonString = JsonConvert.SerializeObject(book);
            var content    = new StringContent(jsonString, Encoding.UTF8, "application/json");
            var response   = await httpClient.PostAsync("/api/Books", content);

            var code   = response.StatusCode;
            var result = responseReader.ReadObjectAsync <Book>(response);

            if (code == (HttpStatusCode)200)
            {
                return(await result);
            }
            return(null);
        }
        public async Task <PenaltiesAccounting> AddPenaltiesAccounting(PenaltiesAccounting penaltiesAccounting)
        {
            var jsonString = JsonConvert.SerializeObject(penaltiesAccounting);
            var content    = new StringContent(jsonString, Encoding.UTF8, "application/json");
            var response   = await httpClient.PostAsync("/api/PenaltiesAccountings", content);

            var code   = response.StatusCode;
            var result = responseReader.ReadObjectAsync <PenaltiesAccounting>(response);

            if (code == (HttpStatusCode)200)
            {
                return(await result);
            }
            return(null);
        }