add custom attribute for file mime type validation #6

Manually merged
wanderer merged 6 commits from feature-custom-attr-validation into master 2021-01-26 15:24:09 +01:00
Showing only changes of commit 9e90f3ee28 - Show all commits

View File

@ -28,7 +28,7 @@ namespace pwt_0x01_ng.Models.Validation
throw new NotImplementedException($"Attribute {nameof(FileTypeAttr)} not implemented for object {value.GetType()}.");
}
protected string GetErrorMessage(string member_name) => $"make sure the {member_name} you picked really is an image ({type}/*).";
protected string GetErrorMessage(string member_name) => $"make sure the {member_name} you picked really is of type <code>{type}/*</code>. <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types\" title=\"help\" target=\"_blank\" rel=\"noopener noreferer\"><em>help</em></a>";
public void AddValidation(ClientModelValidationContext ctx){
MergeAttribute(ctx.Attributes, "data-val", "true");