user3426396
user3426396

Reputation: 75

MVC ViewModel Scaffold Item

I am using MVC 5 with entity framework 6. I have created some ViewModels and was wondering if you can use Add Scaffold Item to create the controller and views from the ViewModel. I am getting an error when I select the ViewModel when creating using Add Scaffold Item

Does anyone also have a good resource for creating ViewModels searches arent bringing up what im looking for. Basically I have a table which holds listings but I only want to display a few fields in the view from this table, is this possible and also using Add Scaffold Item?

Upvotes: 1

Views: 966

Answers (1)

brk
brk

Reputation: 1456

I haven't tried to scaffold ViewModels myself but what error are you getting specifically?

Furthermore it seems there are possibilities of doing so, see this and this.

You could also instead generate POCOs from your table and then Scaffold the controller and views for it. Then to display certain properties create a viewmodel and pass that in and around to your controller and view.

Here is a link regarding viewmodels, I hope it helps.

Upvotes: 1

Related Questions