public virtual RoleStateMergePatchedDto ToRoleStateMergePatchedDto(IRoleStateMergePatched e) { var dto = new RoleStateMergePatchedDto(); dto.RoleEventId = e.RoleEventId; dto.CreatedAt = e.CreatedAt; dto.CreatedBy = e.CreatedBy; dto.CommandId = e.CommandId; dto.Name = e.Name; dto.Description = e.Description; dto.Active = e.Active; dto.IsPropertyNameRemoved = e.IsPropertyNameRemoved; dto.IsPropertyDescriptionRemoved = e.IsPropertyDescriptionRemoved; dto.IsPropertyActiveRemoved = e.IsPropertyActiveRemoved; return(dto); }
public virtual void When(IRoleStateMergePatched e) { ThrowOnWrongEvent(e); if (e.Name == null) { if (e.IsPropertyNameRemoved) { this.Name = default(string); } } else { this.Name = e.Name; } if (e.Description == null) { if (e.IsPropertyDescriptionRemoved) { this.Description = default(string); } } else { this.Description = e.Description; } 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; }
protected virtual IRoleStateMergePatched Map(IMergePatchRole c) { var stateEventId = new RoleStateEventId(c.RoleId, c.Version); IRoleStateMergePatched e = NewRoleStateMergePatched(stateEventId); e.Name = c.Name; e.Description = c.Description; e.Active = c.Active; e.IsPropertyNameRemoved = c.IsPropertyNameRemoved; e.IsPropertyDescriptionRemoved = c.IsPropertyDescriptionRemoved; e.IsPropertyActiveRemoved = c.IsPropertyActiveRemoved; e.CommandId = c.CommandId; e.CreatedBy = (string)c.RequesterId; e.CreatedAt = DateTime.Now; var version = c.Version; return(e); }
public virtual void MergePatch(IMergePatchRole c) { IRoleStateMergePatched e = Map(c); Apply(e); }
void IRoleState.When(IRoleStateMergePatched e) { throw new NotSupportedException(); }