views:

204

answers:

1

Hi everyone!!

I'm working in a ASP.NET MVC project and I have this particular situation: I have 3 pages - Product, Order, User. And in each of these pages I have a link calling the same ActionResult differing only by the argument passed depending on the page I'm in. For example:

public ActionResult(string typeOfPage)
{
   if (typeOfPage == "User")
   {
      //do something
   }
   else if (typeOfPage == "Product")
   {
      //do other things
   }
}

What I want to do now is to get all data from DB depending on "typeOfPage" value. And, of course, in dbml, all the entities have the same name as the typeOfPage value (User, Product, Order).

I'm trying to avoid doing a specific IQueryable for each page, depending on typeOfPage value.

Is there a way to get this typeOfPage string value, get an Entity with the same name and use an IQueryable to get all data from this Entity??

Thanks a lot!!!

+2  A: 
Laurel.Wu