Exemplo n.º 1
0
        protected override void When(object @event)
        {
            Picture picture;

            switch (@event)
            {
            case Events.ClassifiedAdCreated e:
                Id      = new ClassifiedAddId(e.Id);
                OwnerId = new UserId(e.OwnerId);
                State   = ClassifiedAdState.Inactive;
                break;

            case Events.ClassifiedAdTitleChanged e:
                Title = new ClassifiedAdTitle(e.Title);
                break;

            case Events.ClassifiedAdTextUpdated e:
                Text = new ClassifiedAdText(e.AdText);
                break;

            case Events.ClassifiedAdPriceUpdated e:
                Price = new Price(e.Price, e.CurrenccyCode);
                break;

            case Events.ClassifiedAdSentForReview _:
                State = ClassifiedAdState.PendingReview;
                break;

            case Events.PictureAddedToAClassifiedAd e:
                picture = new Picture(Apply);
                ApplyToEntity(picture, e);
                break;
                break;

            case Events.ClassifiedAdPictureResized e:
                break;
            }
        }
Exemplo n.º 2
0
 public void UpdateText(ClassifiedAdText text) => Apply(new Events.ClassifiedAdTextUpdated {
     Id = Id, AdText = text
 });