コード例 #1
0
 public EditAuthorCommandHandler(
     ICurrentUser currentUser,
     IAuthorDomainRepository authorRepository)
 {
     this.currentUser      = currentUser;
     this.authorRepository = authorRepository;
 }
コード例 #2
0
 public LoginUserCommandHandler(
     IIdentity identity,
     IAuthorDomainRepository authorRepository)
 {
     this.identity         = identity;
     this.authorRepository = authorRepository;
 }
コード例 #3
0
 public EditBookCommandHandler(
     ICurrentUser currentUser,
     IBookDomainRepository bookRepository,
     IAuthorDomainRepository authorRepository)
 {
     this.currentUser      = currentUser;
     this.bookRepository   = bookRepository;
     this.authorRepository = authorRepository;
 }
コード例 #4
0
 public ChangeAvailabilityCommandHandler(
     ICurrentUser currentUser,
     IBookDomainRepository bookRepository,
     IAuthorDomainRepository authorRepository)
 {
     this.currentUser      = currentUser;
     this.bookRepository   = bookRepository;
     this.authorRepository = authorRepository;
 }
コード例 #5
0
 public CreateAuthorCommandHandler(
     ICurrentUser currentUser,
     IAuthorDomainRepository authorRepository,
     IAuthorFactory authorFactory)
 {
     this.currentUser      = currentUser;
     this.authorRepository = authorRepository;
     this.authorFactory    = authorFactory;
 }
コード例 #6
0
        public static async Task <Result> AuthorHasBook(
            this ICurrentUser currentUser,
            IAuthorDomainRepository authorRepository,
            int bookId,
            CancellationToken cancellationToken)
        {
            var authorId = await authorRepository.GetAuthorId(
                currentUser.UserId,
                cancellationToken);

            var authorHasBook = await authorRepository.HasBook(
                authorId,
                bookId,
                cancellationToken);

            return(authorHasBook
                ? Result.Success
                : "You cannot edit this book.");
        }