Example #1
0
        }// END Map(ICreate... ////////////////////////////

        protected virtual IUserRoleStateMergePatched MapMergePatch(IMergePatchUserRole c, IUserCommand outerCommand, long version, IUserState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId             = new UserRoleEventId(c.UserId, c.RoleId, version);
            IUserRoleStateMergePatched e = NewUserRoleStateMergePatched(stateEventId);
            var s = outerState.UserRoles.Get(c.RoleId);

            e.Active = c.Active;
            e.IsPropertyActiveRemoved = c.IsPropertyActiveRemoved;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            return(e);
        }// END Map(IMergePatch... ////////////////////////////
        public virtual UserRoleStateMergePatchedDto ToUserRoleStateMergePatchedDto(IUserRoleStateMergePatched e)
        {
            var dto = new UserRoleStateMergePatchedDto();

            dto.UserRoleEventId         = e.UserRoleEventId;
            dto.CreatedAt               = e.CreatedAt;
            dto.CreatedBy               = e.CreatedBy;
            dto.Version                 = e.Version;
            dto.CommandId               = e.CommandId;
            dto.Active                  = e.Active;
            dto.IsPropertyActiveRemoved = e.IsPropertyActiveRemoved;

            return(dto);
        }
Example #3
0
        public virtual void When(IUserRoleStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.Active == null)
            {
                if (e.IsPropertyActiveRemoved)
                {
                    this.Active = default(bool);
                }
            }
            else
            {
                this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);
            }


            this.UpdatedBy = e.CreatedBy;
            this.UpdatedAt = e.CreatedAt;
        }
Example #4
0
 void IUserRoleState.When(IUserRoleStateMergePatched e)
 {
     throw new NotSupportedException();
 }