Esempio n. 1
0
        protected override void When(object @event)
        {
            switch (@event)
            {
            case Events.ClassifiedAdCreated e:
                Id      = new ClassifiedAdId(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.CurrencyCode);
                break;

            case Events.ClassifiedAdSentForReview e:
                State = ClassifiedAdState.PendingReview;
                break;
            }
        }
Esempio n. 2
0
 public ClassifiedAd(ClassifiedAdId id, UserId ownerId)
 {
     Id      = id;
     OwnerId = ownerId;
     State   = ClassifiedAdState.Inactive;
     EnsureValidState();
 }
Esempio n. 3
0
 public ClassifiedAd(ClassifiedAdId id, UserId ownerId)
 {
     Apply(new Events.ClassifiedAdCreated
     {
         Id      = id,
         OwnerId = ownerId
     });
 }
Esempio n. 4
0
        public ClassifiedAd(ClassifiedAdId id, UserId ownerId)
        {
            Id      = id;
            OwnerId = ownerId;
            State   = ClassifiedAdState.Inactive;
            EnsureValidState();

            Apply(new Events.ClassifiedAdCreated
            {
                Id      = id,
                OwnerId = ownerId
            });
        }
Esempio n. 5
0
        protected override void When(object @event)
        {
            switch (@event)
            {
            case Events.PictureAddedToAClassifiedAd e:
                ParentId = new ClassifiedAdId(e.ClassifiedAdId);
                Id       = new PictureId(e.PictureId);
                Location = new Uri(e.Url);
                Size     = new PictureSize {
                    Height = e.Height, Width = e.Width
                };
                Order = e.Order;
                break;

            case Events.ClassifiedAdPictureResized e:
                Size = new PictureSize {
                    Height = e.Height, Width = e.Width
                };
                break;
            }
        }
Esempio n. 6
0
 public ClassifiedAd(ClassifiedAdId id, UserId ownerId)
 {
     Id       = id;
     _ownerId = ownerId;
 }
 public ClassifiedAd(ClassifiedAdId id, UserId ownerId) =>
Esempio n. 8
0
 public void CreateClassifiedAd(ClassifiedAdId id, UserId ownerId)
 {
     var classifiedAd = new ClassifiedAd(id, ownerId);
     // store the entity somehow
 }