CheckboxList, MVC, Many-To-Many Relationship
I have a Request
class and a Building
class with a many to many relationship. A Request can be associated with 1 or more Buildings. I want to take advantage of EditorTemplates to generate checkboxes for each building and check them if associated with the Request.
This might seem like a bit of a loaded question but I'm familiar with EditorTempaltes, ViewModels, etc. I'm just not quite sure how to wire the two up with a many-to-many relationship and checkboxes.
- Do I need to add a bool property to my Building class to indicated checked status?
- For the EditorTemplate how do I indicated status of checked with the many-to-many relationship?
- Should I add 开发者_运维知识库an
IEnumerable<Building>
to my Request viewmodel?
See Many to many checkbox and mvc
精彩评论