public void Handle(ShareLink cmd)
        {
            var linkId = new LinkId(cmd.Link);
            var link = _repository.GetById(linkId);

            if (link == null)
            {
                var url = new Uri(cmd.Link);
                link = new Link(url);
            }
            var topic = new Topic(cmd.Topic);
            var emailsOfReceivers = cmd.EmailsOfReceivers.Select(x => new Receiver(new EmailAddress(x))).ToArray();
            var receivers = new ListOfReceivers(emailsOfReceivers);
            var sharer = new Sharer(new EmailAddress(cmd.EmailOfSharer));
            link.Share(topic, sharer, receivers);
            _repository.Save(link);
        }
Exemple #2
0
 public void Share(Topic topic, Sharer sharer, ListOfReceivers receivers)
 {
     var emailsOfReceivers = receivers.GetEmails().Select<EmailAddress, string>(x => x).ToList();
     ApplyChange(new SharedLink(Id, this.ToString(), sharer.Email, topic, emailsOfReceivers));
 }