Esempio n. 1
0
        public bool isValid(Toner entity)
        {
            var validator = new TonerValidator();
            var result    = validator.Validate(entity);

            return(result.IsValid);
        }
Esempio n. 2
0
        public IList <ErrorMessage> Errors(Toner entity)
        {
            var validator = new TonerValidator();
            var result    = validator.Validate(entity);
            var errors    = new List <ErrorMessage>();

            foreach (var item in result.Errors)
            {
                errors.Add(new ErrorMessage {
                    Key = item.PropertyName, Error = item.ErrorMessage
                });
            }

            return(errors);
        }