Example #1
0
        public async Task <IHttpActionResult> SearchReviewsAsync(int id)
        {
            if (!goodreadsAccess.IsAvailable(DateTime.Now))
            {
                return(StatusCode(HttpStatusCode.ServiceUnavailable));
            }

            try
            {
                Item item = repository.GetItem(id);
                if (item == null)
                {
                    return(NotFound());
                }

                var result = await goodreads.SearchBooksAsync(item);

                return(Ok(result));
            }
            finally
            {
                goodreadsAccess.RequestCompleted(DateTime.Now);
            }
        }