public LibraryContainer(IAuthorContainer authors, IBookContainer books, ICategoryContainer categories, IUserContainer users, IBorrowedContainer borrowed, ISettingsContainer settings) { this.authors = authors; this.books = books; this.categories = categories; this.users = users; this.borrowed = borrowed; this.settings = settings; }
public async Task ValidateAsync(ICategoryContainer сategoryContainer) { if (сategoryContainer == null) { throw new ArgumentNullException(nameof(сategoryContainer)); } var Category = await this.GetAsync(); if (сategoryContainer.CategoryId.HasValue && Category == null) { throw new InvalidOperationException($"Category not found by id {сategoryContainer.CategoryId}"); } }
private async Task <Category> GetBy(ICategoryContainer categoryContainer) { return(await this.CategoryDataAccess.GetByAsync(categoryContainer)); }
public async Task <Category> GetByAsync(ICategoryContainer category) { return(category.CategoryId.HasValue ? this.Mapper.Map <Category>(await this.Context.Category.FirstOrDefaultAsync(x => x.Id == category.CategoryId)) : null); }