Skip to content

Commit

Permalink
Merge pull request #121 from ridercz/patch-1
Browse files Browse the repository at this point in the history
Add missing MergeAttribute method to sample.
  • Loading branch information
dahlbyk authored Sep 4, 2024
2 parents e78489a + 572b715 commit 061c242
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 @@ -120,6 +120,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 061c242

Please sign in to comment.