28 references to TryAddModelError
Microsoft.AspNetCore.Mvc.Abstractions (4)
ModelBinding\ModelStateDictionary.cs (4)
216
return
TryAddModelError
(key, exception.Message);
303
return
TryAddModelError
(key, errorMessage);
309
return
TryAddModelError
(key, exception.Message);
329
TryAddModelError
(key, errorMessage);
Microsoft.AspNetCore.Mvc.Abstractions.Test (6)
ModelBinding\ModelStateDictionaryTest.cs (6)
788
var result = dictionary.
TryAddModelError
("key1", "error1");
820
var result = dictionary.
TryAddModelError
("key1", "error1");
828
result = dictionary.
TryAddModelError
("key3", "error3");
832
result = dictionary.
TryAddModelError
("key4", "error4"); // no-op
893
var result = dictionary.
TryAddModelError
("key1", "error1");
1670
var invalidException = Assert.Throws<InvalidOperationException>(() => dictionary.
TryAddModelError
(key, "errorMessage"));
Microsoft.AspNetCore.Mvc.Core (17)
ModelBinding\Binders\CollectionModelBinder.cs (1)
222
bindingContext.ModelState.
TryAddModelError
(bindingContext.ModelName, message);
ModelBinding\Binders\ComplexObjectModelBinder.cs (3)
122
bindingContext.ModelState.
TryAddModelError
(bindingContext.ModelName, message);
472
bindingContext.ModelState.
TryAddModelError
(modelName, message);
501
bindingContext.ModelState.
TryAddModelError
(modelName, message);
ModelBinding\Binders\ComplexTypeModelBinder.cs (2)
187
bindingContext.ModelState.
TryAddModelError
(bindingContext.ModelName, message);
292
bindingContext.ModelState.
TryAddModelError
(modelName, message);
ModelBinding\Binders\DateTimeModelBinder.cs (1)
79
modelState.
TryAddModelError
(
ModelBinding\Binders\DecimalModelBinder.cs (1)
82
modelState.
TryAddModelError
(
ModelBinding\Binders\DoubleModelBinder.cs (1)
82
modelState.
TryAddModelError
(
ModelBinding\Binders\EnumTypeModelBinder.cs (1)
51
bindingContext.ModelState.
TryAddModelError
(
ModelBinding\Binders\FloatModelBinder.cs (1)
82
modelState.
TryAddModelError
(
ModelBinding\Binders\KeyValuePairModelBinder.cs (2)
64
bindingContext.ModelState.
TryAddModelError
(
73
bindingContext.ModelState.
TryAddModelError
(
ModelBinding\Binders\SimpleTypeModelBinder.cs (1)
122
bindingContext.ModelState.
TryAddModelError
(
ModelBinding\Binders\TryParseModelBinder.cs (1)
73
bindingContext.ModelState.
TryAddModelError
(
ModelBinding\ParameterBinder.cs (1)
187
actionContext.ModelState.
TryAddModelError
(modelName, message);
ModelBinding\Validation\ValidationVisitor.cs (1)
237
ModelState.
TryAddModelError
(key, result.Message);
Microsoft.AspNetCore.Mvc.NewtonsoftJson (1)
JsonPatchExtensions.cs (1)
54
modelState.
TryAddModelError
(key, jsonPatchError.ErrorMessage);