ViewModel with SelectList binding in ASP.NET MVC2

前端 未结 3 1336
北恋
北恋 2021-01-05 01:29

I am trying to implement an Edit ViewModel for my Linq2SQL entity called Product. It has a foreign key linked to a list of brands.

Currently I am populating the bra

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-05 02:20

    You should build that lookup INTO your ViewModel. Then create a Builder object that builds the ViewModel and populates that lookup.

    After all, that's what your ViewModel is for: to provide a model specifically for your view.

提交回复
热议问题