コード例 #1
0
        public ContentResult GetPropertyValidationResult(object model, string key, object value)
        {
            try
            {
                SetProperty(model, key, value);
            }
            catch (Exception)
            {
                var propertyDisplayName = model.GetMemberDisplayName(key);
                ModelState.AddModelError(key, ValidationMessages.ValueInvalid(propertyDisplayName));
            }

            return(GetValidationResult(model, key));
        }