Пример #1
0
        protected override void When(object @event)
        {
            switch (@event)
            {
            case Events.ResourceRegistered e:
                Id            = new ResourceId(e.ResourceId);
                ResourceName  = new ResourceName(e.ResourceName);
                ResourceNo    = new ResourceNo(e.ResourceNo);
                ResourcePrice = new ResourcePrice(e.ResourcePrice);
                break;

            case Events.ResourceDeleted e:
                Id        = new ResourceId(e.ResourceId);
                IsDeleted = new IsDeleted(e.IsDeleted);
                break;

            case Events.ResourceNameUpdated e:
                Id           = new ResourceId(e.ResourceId);
                ResourceName = new ResourceName(e.ResourceName);
                break;

            case Events.ResourceNoUpdated e:
                Id         = new ResourceId(e.ResourceId);
                ResourceNo = new ResourceNo(e.ResourceNo);
                break;

            case Events.ResourcePriceUpdated e:
                Id            = new ResourceId(e.ResourceId);
                ResourcePrice = new ResourcePrice(e.ResourcePrice);
                break;
            }
        }
Пример #2
0
 public void ResourceDeleted(IsDeleted isDeleted)
 {
     Apply(new Events.ResourceDeleted
     {
         ResourceId = Id,
         IsDeleted  = isDeleted
     });
 }