/// <summary> /// Add error to custom ModelErrorsSet /// </summary> /// <param name="list">List to add</param> /// <param name="condition">Condition to check</param> /// <param name="field">Name of the field</param> /// <param name="message">Message of the error in en</param> /// <param name="localizedMessage">Message of the error in ru</param> /// <param name="type">Type of the error</param> public static ICollection <CustomModelError> AddError( this ICollection <CustomModelError> list, Func <bool> condition, string field, string message, string localizedMessage, TypeCriticalException type = TypeCriticalException.TRANSACTION) => condition() ? list.AddError(field, message, localizedMessage, type) : list;
internal static ICollection <RuleResult> AddErrors( this ICollection <RuleResult> results, object entity, Rule rule, ICollection <string> messages) { return((messages.Count == 0) ? results : results.AddError(rule, GetEntityName(entity) + String.Join("; ", messages))); }