public static async Task <Volume> SearchISBN(ISBNDTO isbn)
        {
            var result = await service.Volumes.List(JsonConvert.SerializeObject(isbn)).ExecuteAsync();

            if (result != null && result != null)
            {
                var item = result.Items.FirstOrDefault();
                return(item);
            }
            return(null);
        }
Пример #2
0
        public IActionResult GetBookIsbn([FromBody] ISBNDTO item)
        {
            try
            {
                BookService bookservice = new BookService();

                return(Ok(bookservice.GetBookIsbn(item.isbn)));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public async Task <IActionResult> GetBookFromApi([FromBody] ISBNDTO isbn)
        {
            try
            {
                var result = await SearchISBN(isbn);

                if (result != null)
                {
                    return(Ok(result));
                }
                else
                {
                    return(StatusCode(412));
                }
            }
            catch (Exception e)
            {
                return(Ok(SearchISBN(isbn)));
            }
        }