示例#1
0
        public bool isValid(Visit entity)
        {
            var validator = new VisitValidator();
            var result    = validator.Validate(entity);

            return(result.IsValid);
        }
示例#2
0
        public IList <ErrorMessage> Errors(Visit entity)
        {
            var validator = new VisitValidator();
            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);
        }