Ejemplo n.º 1
0
        internal static AuditLogChange <T> Convert(AuditLogChangeJsonModel model)
        {
            var oldValue = Optional.Convert(model.OldValue, model => model.ToType <T>());
            var newValue = Optional.Convert(model.NewValue, model => model.ToType <T>());

            return(new(oldValue, newValue));
        }
Ejemplo n.º 2
0
        internal static AuditLogChange <T> Convert <TOld, TState>(AuditLogChangeJsonModel model, TState state, Func <TOld, TState, T> converter)
        {
            var oldValue = model.OldValue.HasValue
                ? converter(model.OldValue.Value.ToType <TOld>(), state)
                : Optional <T> .Empty;
            var newValue = model.NewValue.HasValue
                ? converter(model.NewValue.Value.ToType <TOld>(), state)
                : Optional <T> .Empty;

            return(new(oldValue, newValue));
        }