Ejemplo n.º 1
0
        public IEnumerable <IEvent> Handle(UpdateCommitteeCommand cmd)
        {
            if (cmd == null)
            {
                throw new ArgumentNullException(nameof(cmd));
            }
            if (cmd.AggregateId == Guid.Empty)
            {
                throw new ArgumentException(nameof(cmd.AggregateId));
            }
            if (cmd.CommitteeId == Guid.Empty)
            {
                throw new ArgumentException(nameof(cmd.CommitteeId));
            }
            if (string.IsNullOrEmpty(nameof(cmd.Name)))
            {
                throw new ArgumentException(nameof(cmd.Name));
            }
            if (string.IsNullOrEmpty(nameof(cmd.Mandate)))
            {
                throw new ArgumentException(nameof(cmd.Mandate));
            }

            var events = new List <IEvent>();

            events.Add(new UpdateCommitteeEvent(cmd.CommitteeId, cmd.AggregateId, cmd.Name, cmd.Mandate));
            return(events);
        }
Ejemplo n.º 2
0
        public IEnumerable<IEvent> Handle(UpdateCommitteeCommand cmd)
        {
            if (cmd == null)
                throw new ArgumentNullException(nameof(cmd));
            if (cmd.AggregateId == Guid.Empty)
                throw new ArgumentException(nameof(cmd.AggregateId));
            if (cmd.CommitteeId == Guid.Empty)
                throw new ArgumentException(nameof(cmd.CommitteeId));
            if (string.IsNullOrEmpty(nameof(cmd.Name)))
                throw new ArgumentException(nameof(cmd.Name));
            if (string.IsNullOrEmpty(nameof(cmd.Mandate)))
                throw new ArgumentException(nameof(cmd.Mandate));

            var events = new List<IEvent>();
            events.Add(new UpdateCommitteeEvent(cmd.CommitteeId, cmd.AggregateId, cmd.Name, cmd.Mandate));
            return events;
        }