public void PostMessage(User user, string message) { CreateAccount(user); Post post = new Post(user, message); MyPosts.Add(post); }
public override ValidationResult AddPost(UserAddPostCommand command) { if (command.NewPost != command.PostToDelete) { MyPosts.Add(command.NewPost); return(ValidationResult.OkResult(new List <DomainEventBase> { new UserAddPostEvent(command.NewPost.Id, command.PostToDelete.Id, Id) })); } return(ValidationResult.ErrorResult(new List <string> { "Can not delete post that should be added" })); }
public override ValidationResult UpdateName(UserUpdateNameCommand command) { var creationResult = Post.Create(new PostCreateCommand("luly")); if (command.Name.Length > 4) { MyPosts.Add(creationResult.CreatedEntity); return(ValidationResult.OkResult(new List <DomainEventBase> { new UserUpdateNameEvent(command.Name, Id) })); } return(ValidationResult.ErrorResult(new List <string> { "Name too short to update" })); }