public virtual MovementTypeStateCreatedDto ToMovementTypeStateCreatedDto(IMovementTypeStateCreated e)
        {
            var dto = new MovementTypeStateCreatedDto();

            dto.MovementTypeEventId = e.MovementTypeEventId;
            dto.CreatedAt           = e.CreatedAt;
            dto.CreatedBy           = e.CreatedBy;
            dto.CommandId           = e.CommandId;
            dto.Description         = e.Description;
            dto.Active = e.Active;
            return(dto);
        }
Example #2
0
        public virtual void When(IMovementTypeStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.Description = e.Description;

            this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);

            this.Deleted = false;

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;
        }
        public virtual void Initialize(IMovementTypeStateCreated stateCreated)
        {
            var aggregateId = stateCreated.MovementTypeEventId.MovementTypeId;
            var state       = new MovementTypeState();

            state.MovementTypeId = aggregateId;
            var aggregate = (MovementTypeAggregate)GetMovementTypeAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
Example #4
0
        protected virtual IMovementTypeStateCreated Map(ICreateMovementType c)
        {
            var stateEventId            = new MovementTypeEventId(c.MovementTypeId, c.Version);
            IMovementTypeStateCreated e = NewMovementTypeStateCreated(stateEventId);

            e.Description = c.Description;
            e.Active      = c.Active;
            e.CommandId   = c.CommandId;


            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            var version = c.Version;


            return(e);
        }
 void IMovementTypeState.When(IMovementTypeStateCreated e)
 {
     throw new NotSupportedException();
 }
Example #6
0
        public virtual void Create(ICreateMovementType c)
        {
            IMovementTypeStateCreated e = Map(c);

            Apply(e);
        }