jeevan

jeevan

  • NA
  • 8
  • 14.7k

How to use multiple model classes in one controller in MVC?

Jan 13 2014 9:44 AM
Hi,

According to my requirement, i have created Model classes like Blocks,Slabs,CustDetails, CustFeedback, CustOrders classes .
Next i created context class for them.
Now i want to use all these classes in Home Controller.Is it possible?
Should i use multiple controllers for them?
Till now i know how to work with single model class in controller.Please suggest

My project is as given below.

There will be login page.

If Admin logged in ,then he can view total blocks and slabs.He can insert,update,delete blocks and slabs.He can view customers orders.He can view customer feedbacks.

If Customers logged in ,then he can view all blocks and slabs available.He can send an order to buy any desired block or slab .He can send feedback or complaints to admin.

My Database tables are:

Blocks,Slabs,CustDetails, CustFeedback, CustOrders .

I created model classes and context classes for them.How to use them in my Home controller.

Generally for single model class ,we do as below while creating controller

Controller Name: Home
Model Class: Block
Data Context Class: MyBlock

then how to do with multiple model classes? Please give me suggestions

Answers (1)