I have just one tables in database and three stored procedure (IUD)..and i m using EF for db integration MVC 4 ..as soon as i insert data in db ..it just display as it as (call it select * from tbl1) ..what if i m going to select data from two tables ..where i should it ..??need to add sp or what else

2 Years
Discussion Span
Last Post by alisnikol

I need column from both tables or put in this way is that I need columns from usr table..right now it will return data from inbox only using following query

var inbox1 = (from usr in db.Tbl_User join inbox in db.Tbl_inbox on usr.id equals inbox.touserid orderby inbox.touserid select inbox).ToList();


You seem to mix UI and Data access, while you should minimize their dependencies over another. MVC is actually a pretty broad pattern which describes how application interacts with user. I think your question is related to data access.

MVC is the way you organize UI. So, model is a piece of information you want to make user interact with. Note, business objects are not priority here. If there is a case when use loads a Person class along with several properties from Business, so be it: your second Person rendition is a perfect model for this case. And so on - each use case requires a different model and you should create different model for different scenarios.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.