示例#1
0
        public static IGuardResult <TResult> OnSuccess <TResult>(this IGuardClause guardClause, Func <TResult> func)
        {
            if (guardClause.HasFailed)
            {
                return(GuardResult.Failure <TResult>(guardClause.Errors));
            }

            return(GuardResult.Success(func()));
        }
示例#2
0
        public static IGuardResult OnSuccess(this IGuardClause guardClause, Action action)
        {
            if (guardClause.HasFailed)
            {
                return(GuardResult.Failure(guardClause.Errors));
            }

            action.Invoke();
            return(GuardResult.Success());
        }