コード例 #1
0
        public BookCommandHandlerTests()
        {
            doctorRepository = new DoctorFakeRepository();
            userRepository   = new UserFakeRepository();
            bookRepository   = new BookFakeRepository(userRepository, doctorRepository);

            _handler = new BookCommandHandler(bookRepository, doctorRepository, userRepository);
        }
コード例 #2
0
        public BookMutation(BookCommandHandler commandHandler)
        {
            Field <BookType>(
                "createBook",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <BookInputType> > {
                Name = "book", Description = "book"
            }
                    ),
                resolve: context =>
            {
                //var human = context.GetArgument<Human>("human");
                var book    = context.GetArgument <Book>("book");
                var command = new CreateBookCommand
                {
                    AuthorId    = book.AuthorId,
                    CategoryId  = book.CategoryId,
                    CountryId   = book.CountryId,
                    LanguageId  = book.LanguageId,
                    PublisherId = book.PublisherId,
                    Description = book.Description,
                    Title       = book.Title
                };

                /*var command = new CreateBookCommand
                 * {
                 *  AuthorId = context.GetArgument<int>("authorId"),
                 *  CategoryId = context.GetArgument<int>("categoryId"),
                 *  CountryId = context.GetArgument<int>("countryId"),
                 *  LanguageId = context.GetArgument<int>("languageId"),
                 *  PublisherId = context.GetArgument<int>("publisherId"),
                 *  Description = context.GetArgument<string>("description"),
                 *  Title = context.GetArgument<string>("title")
                 * };*/

                return(commandHandler.Handle(command));
            });
        }
コード例 #3
0
 public BookController(IUow uow, BookCommandHandler handler, IBookRepository repository) : base(uow)
 {
     _handler    = handler;
     _repository = repository;
 }