public AuthorService(IAuthorRepository authorRepo, IMapper mapper, IAuthorBookRepository authorBookRepo, IBookRepository bookRepo) { this._authorRepo = authorRepo; this._mapper = mapper; this._authorBookRepo = authorBookRepo; this._bookRepo = bookRepo; }
public AuthorService(IUnitOfWork <AlejandriaContext> uoW, IOptions <AlejandriaOptions> alejandriaOptions) : base(uoW) { _authorRepository = uoW.Repository <IAuthorRepository>(); _bookRepository = uoW.Repository <IBookRepository>(); _authorBookRepository = uoW.Repository <IAuthorBookRepository>(); _alejandriaOptions = alejandriaOptions.Value; }
private async Task InitAuthorBook(IAuthorBookRepository authorBookRepository) { try { int authorBookCount = await authorBookRepository.GetCount(); if (authorBookCount != 0) { return; } var authorBookList = new List <AuthorBook> { new AuthorBook { AuthorId = 1, BookId = 1 }, new AuthorBook { AuthorId = 2, BookId = 1 }, new AuthorBook { AuthorId = 3, BookId = 1 }, new AuthorBook { AuthorId = 4, BookId = 1 }, new AuthorBook { AuthorId = 1, BookId = 2 }, new AuthorBook { AuthorId = 2, BookId = 2 }, new AuthorBook { AuthorId = 3, BookId = 2 }, new AuthorBook { AuthorId = 1, BookId = 3 }, new AuthorBook { AuthorId = 4, BookId = 3 }, new AuthorBook { AuthorId = 2, BookId = 4 }, new AuthorBook { AuthorId = 3, BookId = 4 }, new AuthorBook { AuthorId = 4, BookId = 4 }, }; await authorBookRepository.AddRangeAsync(authorBookList); } catch (Exception) { throw; } }
public UnitOfWork(LibraryContext libraryContext, IReaderRepository readerRepository, IReaderCardRepository readerCardRepository, IRecordRepository recordRepository, IBookRepository bookRepository, IChapterRepository chapterRepository, IAuthorBookRepository authorBookRepository, IAuthorRepository authorRepository) { _libraryContext = libraryContext; ReaderRepository = readerRepository; ReaderCardRepository = readerCardRepository; RecordRepository = recordRepository; BookRepository = bookRepository; ChapterRepository = chapterRepository; AuthorBookRepository = authorBookRepository; AuthorRepository = authorRepository; }
public UnitOfWork(LibraryContext libraryContext, SignInManager <User> signInManager, UserManager <User> userManager, IReaderRepository readerRepository, IReaderCardRepository readerCardRepository, IRecordRepository recordRepository, IBookRepository bookRepository, IChapterRepository chapterRepository, IAuthorBookRepository authorBookRepository, IAuthorRepository authorRepository) { _libraryContext = libraryContext; SignInManager = signInManager; UserManager = userManager; ReaderRepository = readerRepository; ReaderCardRepository = readerCardRepository; RecordRepository = recordRepository; BookRepository = bookRepository; ChapterRepository = chapterRepository; AuthorBookRepository = authorBookRepository; AuthorRepository = authorRepository; }
public async Task InitializeDatabase() { using (IServiceScope serviceScope = _serviceProvider.GetRequiredService <IServiceScopeFactory>().CreateScope()) { IAuthorRepository authorRepository = serviceScope.ServiceProvider.GetService <IAuthorRepository>(); IGenreRepository genreRepository = serviceScope.ServiceProvider.GetService <IGenreRepository>(); IBookRepository bookRepository = serviceScope.ServiceProvider.GetService <IBookRepository>(); IBookGenreRepository bookGenreRepository = serviceScope.ServiceProvider.GetService <IBookGenreRepository>(); IAuthorBookRepository authorBookRepository = serviceScope.ServiceProvider.GetService <IAuthorBookRepository>(); await InitAuthors(authorRepository); await InitBooks(bookRepository); await InitGenres(genreRepository); await InitBookGenre(bookGenreRepository); await InitAuthorBook(authorBookRepository); } }
public AuthorService(IUnitOfWork <AlejandriaContext> unitOfWork) : base(unitOfWork) { _authorRepository = UoW.Repository <IAuthorRepository, Author>(); _bookRepository = UoW.Repository <IBookRepository, Book>(); _authorBookRepository = UoW.Repository <IAuthorBookRepository, AuthorBook>(); }
public AuthorBookBll(IAuthorBookRepository repository) { _repository = repository; }
public AuthorBookController(IAuthorBookRepository authorBookRepository, IAuthorRepository authorRepository, IBookRepository bookRepository) { this.authorRepository = authorRepository; this.authorBookRepository = authorBookRepository; this.bookRepository = bookRepository; }