Example #1
0
 protected void AddMemberError(string memberName, string errorMessage)
 {
     if (!ValidationMessages.ContainsKey(memberName))
     {
         ValidationMessages.Add(memberName, errorMessage);
     }
     else
     {
         ValidationMessages[memberName] += Environment.NewLine + errorMessage;
     }
 }
 private void UpdateValidationMessages(IEnumerable <ValidationResult> result)
 {
     if (result != null && result.Any())
     {
         result.ToList().ForEach(r =>
         {
             if (!ValidationMessages.ContainsKey(r.MemberNames.First()))
             {
                 ValidationMessages.Add(r.MemberNames.First(), r.ErrorMessage);
             }
             else
             {
                 ValidationMessages[r.MemberNames.First()] += Environment.NewLine + r.ErrorMessage;
             }
         });
     }
 }