Guest User

Untitled

a guest
Jun 18th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. public ActionResult UpdateWidgetColor( [Bind(Include="Color,ID")]Widget widget )
  2. {
  3.  
  4. }
  5.  
  6. public ActionResult UpdateWidgetColor( int id, string color )
  7. {
  8.  
  9. var whitelist = new string[] { "Color" };
  10.  
  11. Widget widget = db.Widgets.SingleOrDefault( w => w.ID == id );
  12.  
  13. if (widget == null) ...handle missing widget error
  14.  
  15. if (!TryUpdateModel( widget, whitelist ))
  16. {
  17. ...
  18. }
  19. else
  20. {
  21.  
  22. }
  23. }
Add Comment
Please, Sign In to add comment