예제 #1
0
        public ActionResult Edit(EditBlogPostCommand command)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }
            var result = _commandBus.Send(command);

            return(View("Edit", result.Message));
        }
예제 #2
0
        public bool Edit(BlogPost blogPost)
        {
            if (blogPost != null)
            {
                var dbCommand = new EditBlogPostCommand(dbContext, blogPost);
                dbCommand.Execut();
                return(true);
            }

            return(false);
        }
예제 #3
0
        public ICommandResult Execute(EditBlogPostCommand command)
        {
            if (command == null)
            {
                throw new ArgumentNullException();
            }

            try
            {
                var post = new BlogPost();
                AddBlogAppurtenance(command, post);
                _blogRepository.Edit(post);
            }
            catch (Exception exception)
            {
                _logger.Error(exception.Message);
                return(new FailureResult(BlogPostCommandMessage.BlogPostCreationFaild));
            }

            return(new SuccessResult(BlogPostCommandMessage.BlogPostCreatedSuccessfully));
        }