public static void ValidateMappedModel <TSource, TDestination>(this Controller c, TSource source, string prefix, params ValidationTag[] tags) { foreach (var error in ValidationMapper.Map <TSource, TDestination>(source.Validate(tags))) { c.ModelState.AddModelError(prefix + error.PropertyPath, error.Message); } }
public static void ValidateMappedModel <TSource, TDestination>(this Controller c, TSource source) { foreach (var error in ValidationMapper.Map <TSource, TDestination>(source.Validate())) { c.ModelState.AddModelError(error.PropertyPath, error.Message); } }