daily pastebin goal
25%
SHARE
TWEET

Untitled

a guest Aug 16th, 2018 53 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. MonoRail BindObject() equivalent in ASP MVC3?
  2. public class MyModel
  3. {
  4.     [Required]
  5.     public string Name { get; set; }
  6.  
  7.     public string Description { get; set; }
  8. }
  9.    
  10. [HttpPost]
  11. public ActionResult UpdateModel(bool? acceptedConditions)
  12. {
  13.     var model = new MyModel();
  14.     if (acceptedConditions ?? false)
  15.     {
  16.          if (TryUpdateModel(model))
  17.          {
  18.              //Do something when the model is valid
  19.          }
  20.          else
  21.          {
  22.              //Do something else when the model is invalid
  23.          }
  24.  
  25.     }  
  26.     return View();
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top