TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ceci bela
NA
58
12.7k
Multiple Models in Single View in MVC
Aug 8 2014 3:11 PM
Hello, I am trying to replicated this http://www.c-sharpcorner.com/UploadFile/ff2f08/multiple-models-in-single-view-in-mvc/Default.aspx for my project but I am unable to load the data from database.
In that example it gets all the faculty and students this way
private
List
<
Teacher
> GetTeachers()
{
List
<
Teacher
> teachers =
new
List
<
Teacher
>();
teachers.Add(
new
Teacher
{ TeacherId = 1, Code =
"TT"
, Name =
"Tejas Trivedi"
});
teachers.Add(
new
Teacher
{ TeacherId = 2, Code =
"JT"
, Name =
"Jignesh Trivedi"
});
teachers.Add(
new
Teacher
{ TeacherId = 3, Code =
"RT"
, Name =
"Rakesh Trivedi"
});
return
teachers;
}
Assuming that I also have
public
class
Teacher / Student class
How could I load the values from the database?
private
List
<
Teacher
> GetTeachers()
{
DBContextEntities db = new DBContextEntities();
List
<
Teacher
> teachers =
new
List
<
Teacher
>();
????
return
teachers;
}
Reply
Answers (
6
)
Export Gridview and image to excel Report
how to set expired password date in databse in mvc