Example #1
0
        protected override void When(object e)
        {
            switch (e)
            {
            case Events.V1.BribeCreated x:
                Id           = x.Id;
                name         = (ServiceName)x.Name;
                amount       = (BribeAmount)x.Amount;
                addressLocal = x.AddressLocal;
                timestamp    = (BribeTimestamp)x.Timestamp;
                break;

            case Events.V1.BribePublished x:
                categoryInternational = (ServiceCategory)x.CategoryInternational;
                isPublished           = true;
                break;
            }
        }
Example #2
0
        public static Bribe Create(
            ServiceName name,
            BribeAmount amount,
            Address addressLocal,
            BribeTimestamp timestamp)
        {
            var bribe = new Bribe();

            bribe.Apply(new Events.V1.BribeCreated
            {
                Id           = Guid.NewGuid(),
                Name         = (string)name,
                Amount       = (MoneyRange)amount,
                Timestamp    = (DateTimeOffset)timestamp,
                AddressLocal = addressLocal,
                CreatedAt    = DateTimeOffset.UtcNow
            });

            return(bribe);
        }