Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
        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}");
            }
        }
Exemplo n.º 3
0
 private async Task <Category> GetBy(ICategoryContainer categoryContainer)
 {
     return(await this.CategoryDataAccess.GetByAsync(categoryContainer));
 }
Exemplo n.º 4
0
 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);
 }