public ActionResult Edit(EditBlogPostCommand command) { if (!ModelState.IsValid) { return(View()); } var result = _commandBus.Send(command); return(View("Edit", result.Message)); }
public bool Edit(BlogPost blogPost) { if (blogPost != null) { var dbCommand = new EditBlogPostCommand(dbContext, blogPost); dbCommand.Execut(); return(true); } return(false); }
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)); }