Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 17th, 2012  |  syntax: None  |  size: 0.86 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Avoid model validation of relations classes
  2. public partial class Usuario
  3. {
  4.     public Usuario()
  5.     {
  6.         this.Campana = new HashSet<Campana>();
  7.     }
  8.  
  9.     public int IDUsuario { get; set; }
  10.     public int IDPerfil_FK { get; set; }
  11.     public string Nombre { get; set; }
  12.     public string Password { get; set; }
  13.     public bool Activo { get; set; }
  14.  
  15.     public virtual Perfil Perfil { get; set; }
  16.     public virtual ICollection<Campana> Campana { get; set; }
  17. }
  18.        
  19. public class UsuarioProfileViewModel
  20. {
  21.     public int IDUsuario { get; set; }
  22.     public string Nombre { get; set; }
  23.     public bool Activo { get; set; }
  24.  
  25.     // Other properties for that view
  26. }
  27.        
  28. public ActionResult UsuarioProfile(UsuarioProfileViewModel model) {
  29. {
  30.     // Fill the missing properties for the model (when needed)
  31.  
  32.     View(model);
  33. }
  34.        
  35. @Html.Action("UsuarioProfile", new { UsuarioID = 10 })