Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MonoRail BindObject() equivalent in ASP MVC3?
- public class MyModel
- {
- [Required]
- public string Name { get; set; }
- public string Description { get; set; }
- }
- [HttpPost]
- public ActionResult UpdateModel(bool? acceptedConditions)
- {
- var model = new MyModel();
- if (acceptedConditions ?? false)
- {
- if (TryUpdateModel(model))
- {
- //Do something when the model is valid
- }
- else
- {
- //Do something else when the model is invalid
- }
- }
- return View();
- }
Add Comment
Please, Sign In to add comment