public WEBResult <bool> isValid() { var props = this.GetType().GetProperties().Where(a => a.CustomAttributes.Where(at => at.AttributeType.Name == "RequiredAttribute").Count() > 0); foreach (var item in props) { if (item.GetValue(this) == null) { return(WEBResult <bool> .Error(ResponseCode.BackendInternalServer, item.CustomAttributes.Where(at => at.AttributeType.Name == "RequiredAttribute").FirstOrDefault().NamedArguments.First(a => a.MemberName == "ErrorMessage").TypedValue.Value.ToString())); } } return(WEBResult <bool> .Success(true)); }
public WEBResult <bool> isValid() { if (!base.isValid().isSuccess) { return(base.isValid()); } if (NewPassword != ConfirmPassword) { return(WEBResult <bool> .Error(ResponseCode.UserValidationField, "Confirm Password Not the same of New Password")); } return(WEBResult <bool> .Success(true)); }