Example #1
0
        public SimpleResult <bool> Validate(TEntity entity)
        {
            var validationResult = _validator.Validate(entity);
            var result           = new SimpleResult <bool>(validationResult.IsValid);

            if (!validationResult.IsValid)
            {
                result.AddError(validationResult.Errors.Select(e => new SimpleResultError(e.ErrorMessage, e.ErrorCode)));
            }

            return(result);
        }