protected override void When(object @event)
        {
            Facility facility;

            switch (@event)
            {
            case SkiPassCreated e:
                Id         = new SkiPassId(e.Id);
                Name       = new SkiPassName(e.Name);
                Facilities = new List <Facility>();
                break;

            case SkiPassNameChanged e:
                Name = new SkiPassName(e.Name);
                break;

            case UpdatedDefault e:
                IsDefault = new SkiPassDefault(e.IsDefault);
                break;

            // facility
            case FacilityAddedToSkiPass e:
                facility = new Facility(Apply);
                ApplyToEntity(facility, e);
                Facilities.Add(facility);
                break;

            case FacilityNameChanged e:
                facility = FindFacility(new FacilityId(e.FacilityId));
                ApplyToEntity(facility, @event);
                break;
            }
        }
 public void UpdateName(SkiPassName skiPassName)
 {
     Apply(new SkiPassNameChanged
     {
         Id   = Id,
         Name = skiPassName
     });
 }
 public SkiPass(SkiPassId id, SkiPassName skiPassName, SkiPassDefault defaultSkiPass)
 {
     Facilities = new List <Facility>();
     Apply(new SkiPassCreated
     {
         Id   = id,
         Name = skiPassName
     });
 }