예제 #1
0
        public BaseModelValidationResult Validate()
        {
            var validationResult = new BaseModelValidationResult();

            if (string.IsNullOrWhiteSpace(Product))
            {
                validationResult.Append($"Product cannot be empty");
            }

            if (string.IsNullOrWhiteSpace(Material))
            {
                validationResult.Append($"Material cannot be empty");
            }

            if (!(84 < Content && Content < 10001))
            {
                validationResult.Append($"Content {Content} cannot be <85");
            }

            if (!(0 < Price))
            {
                validationResult.Append($"Price cannot be <0");
            }

            return(validationResult);
        }
예제 #2
0
        public BaseModelValidationResult Validate()
        {
            var validationResult = new BaseModelValidationResult();

            if (string.IsNullOrWhiteSpace(FIO))
            {
                validationResult.Append($"FIO cannot be empty");
            }
            if (string.IsNullOrWhiteSpace(Group))
            {
                validationResult.Append($"Group cannot be empty");
            }
            if (string.IsNullOrWhiteSpace(Birth))
            {
                validationResult.Append($"Birth cannot be empty");
            }
            if (string.IsNullOrWhiteSpace(Place_live))
            {
                validationResult.Append($"Place_live cannot be empty");
            }
            if (!(0 < Curs && Curs < 5))
            {
                validationResult.Append($"Curs {Curs} is out of range (1..4)");
            }
            if (!(0 < Number_stud && Number_stud < 999))
            {
                validationResult.Append($"Number_stud {Number_stud} is out of range (0..999)");
            }
            return(validationResult);
        }
예제 #3
0
        public BaseModelValidationResult Validate()
        {
            var validationResult = new BaseModelValidationResult();

            if (string.IsNullOrWhiteSpace(name))
            {
                validationResult.Append($"name cannot be empty");
            }
            if (!(0 < price))
            {
                validationResult.Append($"price {price} cannot be <0");
            }
            if (!(0 < capacity))
            {
                validationResult.Append($"capacity {capacity} cannot be <0");
            }

            return(validationResult);
        }