MvcExtensions / Core

MvcExtensions - Extend everything
Microsoft Public License
52 stars 17 forks source link

Implemented Remote validation support for MvcExtensions #2

Closed AlexBar closed 12 years ago

AlexBar commented 12 years ago

Hi,

I've implemented Remote validation support. Available methods:

Route based configuration: .Remote(c => c.For("routeName")); .Remote(c => c.For("routeName", new[] { "Id", "Id2" }));

Configuration via string-based methods: .Remote(c => c.For(controller, action)); .Remote(c => c.For(controller, action, areaName)); .Remote(c => c.For(controller, action, new[]{additionalFields})); .Remote(c => c.For(controller, action, new[] { additionalField1, additionalField2 })); .Remote(c => c.For(controller, action, areaName, new[] { additionalFields }));

Configuration via strong-typed methods: .Remote(c => c.For(a => a.CheckUsername2(null, null))); // additional fields will automatically parsed from controller action method .Remote(c => c.For(a => a.CheckUsername2(null, null), "area")); .Remote(c => c.For(a => a.CheckUsername2(null, null), new[] { additionalField1, additionalField2 })); .Remote(c => c.For(a => a.CheckUsername2(null, null), "area", new[] { additionalField1, additionalField2 })); Simplified version when no any additional fields needed: .Remote(c => c.For(x => x.CheckUsername1)); .Remote(c => c.For(x => x.CheckUsername1, areaName));

To set http method use: .Remote(c => c.HttpMethod(httpMethod).For(x => x.CheckUsername1));

hazzik commented 12 years ago

Thanks

hazzik commented 12 years ago

Alex, could you please update wiki with documentation how to use this?

AlexBar commented 12 years ago

Done: https://github.com/MvcExtensions/Core/wiki/Remote-validation

hazzik commented 12 years ago

Cool, thanks