ResultExtensionsOkIf(Boolean, String) Method
Creates a result as Ok variant if the
okCondition holds.
Otherwise, it will map into an Err.
static Res ValidateInput(Form form)
{
return OkIf(!form.HasEmptyFields())
.OkIf(form.Date <= DateTime.Now)
// chained validation calls
.OkIf(repo.AlreadyContains(form.Id));
}
Namespace: Orx.Fun.ResultAssembly: Orx.Fun.Result (in Orx.Fun.Result.dll) Version: 1.3.0+344c8bdd6f720ccfb2d8db7c61b76cf02be18f5f
public static Res OkIf(
bool okCondition,
string strOkCondition = ""
)
- okCondition Boolean
- Condition that must hold for the return value to be Ok().
- strOkCondition String (Optional)
- Name of the condition; to be appended to the error message if it does not hold. Omitting the argument will automatically be filled with the condition's expression in the caller side.
Res