Ejemplo n.º 1
0
 public void AddChild(Parent parent, Child child)
 {
     Raise(ChildAddedDomainEvent.Create(this,
                                        parent.Id,
                                        child.Id,
                                        child.GetName(),
                                        child.GetBirthDate()));
 }
Ejemplo n.º 2
0
        private void When(ChildAddedDomainEvent domainEvent)
        {
            children = children ?? new List <Child>();

            Child child = Child.Create(
                domainEvent.ChildId,
                domainEvent.Name,
                domainEvent.BirthDate,
                Custody.Create(CustodyEnum.ChildConfirmedWithFamily));

            children.Add(child);

            foreach (Parent parent in parents)
            {
                if (parent.Id == domainEvent.ParentId)
                {
                    parent.AddChild(child);
                }
            }
        }