AddError() public method

public AddError ( string error ) : void
error string
return void
        private void Validate(ErrorBucket errors)
        {
            // do basic data presence validation...
            if (string.IsNullOrEmpty(Username))
            {
                errors.AddError("Username is required.");
            }
            if (string.IsNullOrEmpty(Email))
            {
                errors.AddError("Email is required.");
            }
            if (string.IsNullOrEmpty(Password))
            {
                errors.AddError("Password is required.");
            }
            if (string.IsNullOrEmpty(Confirm))
            {
                errors.AddError("Confirm password is required.");
            }

            // check the passwords...
            if (!(string.IsNullOrEmpty(Password)) && this.Password != this.Confirm)
            {
                errors.AddError("The passwords do not match.");
            }
        }
Ejemplo n.º 2
0
 private void Validate(ErrorBucket errors)
 {
     // do basic data presence validation...
     if (string.IsNullOrEmpty(Username))
     {
         errors.AddError("Username is required.");
     }
     if (string.IsNullOrEmpty(Password))
     {
         errors.AddError("Password is required.");
     }
 }
        protected override Task <ErrorBucket> ValidateAsync()
        {
            var bucket = new ErrorBucket();

            if (string.IsNullOrEmpty(this.Item.Title))
            {
                bucket.AddError("Title is required.");
            }
            if (string.IsNullOrEmpty(this.Item.Description))
            {
                bucket.AddError("Description is required.");
            }
            if (!(this.HasImage))
            {
                bucket.AddError("An image is required.");
            }
            if (this.Item.Latitude == 0 && this.Item.Longitude == 0)
            {
                bucket.AddError("A position is required.");
            }

            // return...
            return(Task.FromResult <ErrorBucket>(bucket));
        }
        private void Validate(ErrorBucket errors)
        {
            // do basic data presence validation...
            if (string.IsNullOrEmpty(Username))
                errors.AddError("Username is required.");
            if (string.IsNullOrEmpty(Email))
                errors.AddError("Email is required.");
            if (string.IsNullOrEmpty(Password))
                errors.AddError("Password is required.");
            if (string.IsNullOrEmpty(Confirm))
                errors.AddError("Confirm password is required.");

            // check the passwords...
            if (!(string.IsNullOrEmpty(Password)) && this.Password != this.Confirm)
                errors.AddError("The passwords do not match.");
        }
 private void Validate(ErrorBucket errors)
 {
     // do basic data presence validation...
     if (string.IsNullOrEmpty(Username))
         errors.AddError("Username is required.");
     if (string.IsNullOrEmpty(Password))
         errors.AddError("Password is required.");
 }