0

In the epic quest of me getting my Create and Edit methods working for my complex model, I've come up with an idea - adding a boolean IsSelected property to one of my entity classes for use with checkboxes in my views. Is it possible? Would something as simple as

public partial class Platform : SomeBaseClass
{
    public bool IsSelected { get; set; }
}

Do the trick?

Major Productions
  • 5,914
  • 13
  • 70
  • 149

1 Answers1

2

Yes, it works. Have you tried it?

That said, I recommend dedicated view models.

Craig Stuntz
  • 125,891
  • 12
  • 252
  • 273
  • Haven't had a chance to try it as I'm away from my dev computer. I just figured it was the easiest way to solve my problem here: http://stackoverflow.com/questions/4196247/mvc2-model-binding-w-many-to-many-at-the-cusp Unless you have a better/cleaner solution. – Major Productions Nov 16 '10 at 20:23
  • I agree with stuntz, instead of putting isselected in the entity make a platformitemviewmodel and wrap your entity in that with an extra isselected property. this will keep your model cleaner. – dnndeveloper Nov 17 '10 at 02:21