
Untitled
By: a guest on
May 17th, 2012 | syntax:
None | size: 0.86 KB | hits: 14 | expires: Never
Avoid model validation of relations classes
public partial class Usuario
{
public Usuario()
{
this.Campana = new HashSet<Campana>();
}
public int IDUsuario { get; set; }
public int IDPerfil_FK { get; set; }
public string Nombre { get; set; }
public string Password { get; set; }
public bool Activo { get; set; }
public virtual Perfil Perfil { get; set; }
public virtual ICollection<Campana> Campana { get; set; }
}
public class UsuarioProfileViewModel
{
public int IDUsuario { get; set; }
public string Nombre { get; set; }
public bool Activo { get; set; }
// Other properties for that view
}
public ActionResult UsuarioProfile(UsuarioProfileViewModel model) {
{
// Fill the missing properties for the model (when needed)
View(model);
}
@Html.Action("UsuarioProfile", new { UsuarioID = 10 })