public async Task <IActionResult> Get(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "Books({isbn})")] HttpRequest req,
            [Inject] IBookSearchService bookSearchService,
            ILogger log,
            string isbn)
        {
            log.LogInformation("Request a book based on ISBN13");

            if (isbn == null)
            {
                return(new BadRequestObjectResult("Please pass ISBN number on the query string."));
            }

            var book = await bookSearchService.SearchIsbn(isbn);

            return(new OkObjectResult(book) as ActionResult);
        }
 public ISBNController(IBookSearchService bookSearchService)
 {
     _bookSearchService = bookSearchService;
 }
 public MainViewModel(IDataService data, IBookSearchService bookSearch)
 {
     this.data       = data ?? throw new ArgumentNullException(nameof(data));
     this.bookSearch = bookSearch ?? throw new ArgumentNullException(nameof(bookSearch));
     Books           = new ObservableCollection <Book>();
 }
Exemple #4
0
 public HomeController(IBookSearchService bookSearchService, IMapper mapper)
 {
     _bookSearchService = bookSearchService;
     _mapper            = mapper;
 }
Exemple #5
0
 public HomeController(IBookSearchService bookSearchService, IBookRepository repository)
 {
     _bookSearchService = bookSearchService;
     _repository        = repository;
 }