public override ValidationResult Validate(ActionType actionType)
        {
            var collection = new ValidationMessageCollection();

            collection.AddEmptyMessage(Code, "Code");
            if (actionType != ActionType.Delete) {
                collection.AddEmptyMessage(Name, "Name");
            }

            if (actionType == ActionType.Add) {
                //TODO: db check for unique code.
            }

            return collection.ToValidationResult();
        }
        public override ValidationResult Validate(ActionType actionType)
        {
            var collection = new ValidationMessageCollection();

            collection.AddEmptyMessage(Code, "Code");
            if (actionType != ActionType.Delete)
            {
                collection.AddEmptyMessage(Name, "Name");
            }

            if (actionType == ActionType.Add)
            {
                //TODO: db check for unique code.
            }

            return(collection.ToValidationResult());
        }
Esempio n. 3
0
        public override ValidationResult Validate(ActionType actionType)
        {
            var validationResult = base.Validate(actionType);
            if (actionType == ActionType.Delete) {
                return validationResult;
            }

            var collection = new ValidationMessageCollection();
            collection.AddRange(validationResult.Messages);

            collection.AddEmptyMessage(PhoneNumber, "PhoneNumber");

            return collection.ToValidationResult();
        }
Esempio n. 4
0
        public override ValidationResult Validate(ActionType actionType)
        {
            var validationResult = base.Validate(actionType);

            if (actionType == ActionType.Delete)
            {
                return(validationResult);
            }

            var collection = new ValidationMessageCollection();

            collection.AddRange(validationResult.Messages);

            collection.AddEmptyMessage(PhoneNumber, "PhoneNumber");

            return(collection.ToValidationResult());
        }