Skip to content

Commit

Permalink
Add missing MergeAttribute method to sample.
Browse files Browse the repository at this point in the history
The sample contains call to undefined method MergeAttribute and does not work. I added the method.
  • Loading branch information
ridercz authored Aug 21, 2024
1 parent 343408d commit 572b715
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,16 @@ public class ClassicMovieAttribute : ValidationAttribute, IClientModelValidator
var year = _year.ToString(CultureInfo.InvariantCulture);
MergeAttribute(context.Attributes, "data-val-classicmovie-year", year);
}

private static bool MergeAttribute(IDictionary<string, string> attributes, string key, string value) {
if (attributes.ContainsKey(key)) {
return false;
}

attributes.Add(key, value);
return true;
}

}
```

Expand Down

0 comments on commit 572b715

Please sign in to comment.