Rebel.Cms.Web.ModelStateExtensions.Merge C# (CSharp) Method

Merge() public static method

Merges ModelState that has names matching the prefix
public static Merge ( this state, ModelStateDictionary dictionary, string prefix ) : void
state this
dictionary ModelStateDictionary
prefix string
return void
        public static void Merge(this ModelStateDictionary state, ModelStateDictionary dictionary, string prefix)
        {
            if (dictionary == null)
                return;
            foreach (var keyValuePair in dictionary.Where(keyValuePair => keyValuePair.Key.StartsWith(prefix + ".")))
            {
                state[keyValuePair.Key] = keyValuePair.Value;
            }
        }