예제 #1
0
 public void Handle(SubmitPost submitPost)
 {
     var emailOfPoster = new EmailAddress(submitPost.EmailOfPoster);
     var discussionId = new DiscussionId(submitPost.DiscussionId);
     var discussion = _repository.GetById(discussionId);
     discussion.SubmitPost(emailOfPoster, submitPost.BodyText);
     _repository.Save(discussion);
 }
예제 #2
0
파일: User.cs 프로젝트: SabrinaMH/ShareIt
        public User(Name name, EmailAddress email)
            : base(new UserId(email))
        {
            if (name == null) throw new ArgumentNullException("name");
            if (email == null) throw new ArgumentNullException("email");

            ApplyChange(new UserRegistered(Id, name, email));
        }
예제 #3
0
파일: Post.cs 프로젝트: SabrinaMH/ShareIt
        public Post(EmailAddress emailOfPoster, string bodyText, int postNumber)
        {
            if (String.IsNullOrWhiteSpace(bodyText))
                throw new ArgumentException(String.Format("{0} cannot be null or white spaces", bodyText));
            if (emailOfPoster == null) throw new ArgumentNullException("emailOfPoster");
            if (postNumber < 0) throw new ArgumentException(string.Format("{0} cannot be negative", postNumber));

            EmailOfPoster = emailOfPoster;
            BodyText = bodyText;
            PostNumber = postNumber;
        }
예제 #4
0
 public void Handle(RegisterUser registerUser)
 {
     var user = _repository.GetById(registerUser.Email);
     if (user != null)
     {
         throw new EmailAlreadyRegisteredException(registerUser.Email);
     }
     var name = new Name(registerUser.Name);
     var emailAddress = new EmailAddress(registerUser.Email);
     user = new User(name, emailAddress);
     _repository.Save(user);
 }
예제 #5
0
파일: User.cs 프로젝트: SabrinaMH/ShareIt
 private void Apply(UserRegistered @event)
 {
     Id = new UserId(@event.UserId);
     _name = new Name(@event.Name);
     _email = new EmailAddress(@event.Email);
 }
예제 #6
0
 public Participant(EmailAddress email)
 {
     Email = email;
 }