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())); }
public static IGuardResult OnSuccess(this IGuardClause guardClause, Action action) { if (guardClause.HasFailed) { return(GuardResult.Failure(guardClause.Errors)); } action.Invoke(); return(GuardResult.Success()); }