Ejemplo n.º 1
0
        /// <summary>
        /// Sends a Get request.
        /// </summary>
        /// <param name="id">Filtering parameter.</param>
        /// <returns>Server response.</returns>
        internal static HttpResponseMessage ReturnBooksById(string id)
        {
            var getAllBooksUrl = EndpointsConstants.BaseUrl + "/api/books/" + id;
            var response       = GetHelpMethods.CreateGetRequest(getAllBooksUrl);

            return(response);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sends a Get request.
        /// </summary>
        /// <param name="title">Filtering parameter.</param>
        /// <returns>Book array containing this title.</returns>
        internal static JArray ReturnBooksByTitle(string title)
        {
            var    getAllBooksUrl = EndpointsConstants.BaseUrl + "/api/books?title=" + title;
            var    response       = GetHelpMethods.CreateGetRequest(getAllBooksUrl);
            var    responseJson   = response.Content.ReadAsStringAsync().Result;
            JArray arr            = JArray.Parse(responseJson);

            return(arr);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Sends a Get request.
        /// </summary>
        /// <returns>Counts of all books in DB.</returns>
        internal static int ReturnAllBooksCount()
        {
            var    getAllBooksUrl = EndpointsConstants.BaseUrl + "/api/books";
            var    response       = GetHelpMethods.CreateGetRequest(getAllBooksUrl);
            var    responseJson   = response.Content.ReadAsStringAsync().Result;
            JArray arr            = JArray.Parse(responseJson);

            return(arr.Count);
        }