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
Laxmi Katti
NA
25
5.5k
Get data from multiple table by using single func in webapi
Jul 15 2018 11:55 PM
I have to write a single query or stored procedure or function which can display all tables data using ASP.Net WEB API.
Please help me to to find solution.
public class StudentController : ApiController
{
EmployeeDbEntities1 entities=new EmployeeDbEntities1();
public IEnumerable<Students> Get()
{
List<Students> ListStud = new List<Students>();
var query = (from a in entities.tblstudents
select a).ToList();
query.ForEach(s =>
{
ListStud.Add(new Students
{
StudId = s.StudentId,
StudName = s.Name,
StudAdd = s.Address,
StudGender = s.Gender,
StudStd = s.Standard
}
);
}
);
return ListStud;
}
[Route("~/api/User")]
public List<User> get()
{
List<User> users = new List<User>();
var query = (from a in entities.tblUsers
select a).ToList();
query.ForEach(u =>
users.Add(new User { username = u.UserName, password = u.Password }
)
);
return users;
}
Reply
Answers (
4
)
hosting a asp.net mvc 5 website
How to use Node Js for web development