Esempio n. 1
0
 public BooksController(IUnitOfWork unitOfWork, IBookRepositoryService bookRepositoryService,
                        IRentBookRepositoryService rentBookRepositoryService, IBookRatingRepositoryService bookRatingRepositoryService)
 {
     this.unitOfWork                  = unitOfWork;
     this.bookRepositoryService       = bookRepositoryService;
     this.rentBookRepositoryService   = rentBookRepositoryService;
     this.bookRatingRepositoryService = bookRatingRepositoryService;
 }
        /// <summary>
        /// Creates a new instance of <see cref="BooksController"/>
        /// </summary>
        /// <param name="bookRepository">Used for manipulating and accessing <see cref="Book"/> resources</param>
        /// <param name="logger">Used for logging</param>
        /// <param name="imageService">Used for saving and deleting <see cref="Book"/> Images</param>
        /// <param name="config">Used to access the application configuration</param>
        public BooksController(IBookRepositoryService bookRepository, ILogger <BooksController> logger,
                               IBookImageService imageService, IConfiguration config)
        {
            _bookRepository = bookRepository;
            _logger         = logger;
            _imageService   = imageService;
            _config         = config;

            int.TryParse(_config["Books:PageSize"], out PageSize);
            int.TryParse(_config["Books:ImageSize"], out BookImageSize);
        }