コード例 #1
0
        public async Task <int> AddBlogPostAsync(string title, string content)
        {
            var command = new CreateBlogPostCommand {
                Content = content, Title = title
            };

            await _addBlogPostHandler.HandleAsync(command);

            return(command.CreatedId);
        }
コード例 #2
0
        public ActionResult Create(CreateBlogPostCommand command)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }
            var result = _commandBus.Send(command);

            return(View("Create", result.Message));
        }
コード例 #3
0
        public async Task <string> CreateBlogPostAsync(string title, string content)
        {
            var command = new CreateBlogPostCommand
            {
                Content = content,
                Title   = title
            };

            await _writeRepository.CreateAsync(new CreateBlogPostOperation(command));

            return(command.CreatedBlogPostId ?? throw new Exception());
        }
コード例 #4
0
 public BlogPostCreation(CreateBlogPostCommand command)
 {
     _command = command;
 }
コード例 #5
0
 public CreateBlogPostOperation(CreateBlogPostCommand command)
 {
     _command = command;
 }
コード例 #6
0
 public async Task <Guid> CreateAsync(CreateBlogPostCommand command)
 {
     return(await Mediator.Send(command));
 }