From 572b715b374a16e3135fadeb814178720b748e18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Altair=20Val=C3=A1=C5=A1ek?= Date: Wed, 21 Aug 2024 23:46:41 +0200 Subject: [PATCH] Add missing MergeAttribute method to sample. The sample contains call to undefined method MergeAttribute and does not work. I added the method. --- README.MD | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.MD b/README.MD index 6703b99..0845cf2 100644 --- a/README.MD +++ b/README.MD @@ -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 attributes, string key, string value) { + if (attributes.ContainsKey(key)) { + return false; + } + + attributes.Add(key, value); + return true; + } + } ```