Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Make prefix optional
  • Loading branch information
RehanSaeed committed Aug 17, 2022
commit d9a6588720614c367410e18236e26c02a843d42f
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static class ValidationResultExtension {
/// <param name="result">The validation result to store</param>
/// <param name="modelState">The ModelStateDictionary to store the errors in.</param>
/// <param name="prefix">An optional prefix. If omitted, the property names will be the keys. If specified, the prefix will be concatenated to the property name with a period. Eg "user.Name"</param>
public static void AddToModelState(this ValidationResult result, ModelStateDictionary modelState, string prefix) {
public static void AddToModelState(this ValidationResult result, ModelStateDictionary modelState, string prefix = null) {
if (!result.IsValid) {
foreach (var error in result.Errors) {
string key = string.IsNullOrEmpty(prefix)
Expand Down