-2

I need to covert that sql code into ADO.net entity framework code please need some one help because i am new to the mvc asp.net .

Thnaks

SELECT A.cid, A.cname,    
B.sid, B.lname,B.fname,    
C.section,c.crn    
FROM courses A, students B, sections C, Registration D    
WHERE A.cid = C.cid AND    
B.sid = D.sid AND    
c.crn = d.crn AND    
c.crn = 1003 ;    
ORDER BY B.lname,B.fname ASC;
Gert Arnold
  • 105,341
  • 31
  • 202
  • 291
DilW
  • 27
  • 2
  • 8
  • Where do you need help? We don't know where to start if you don't tell what you did so far. Have you got a context, for instance? – Gert Arnold Oct 27 '13 at 20:57
  • `private EmpiteHrSystemContextnew db = new EmpiteHrSystemContextnew(); // // GET: /Employee/ public ActionResult Index() { var tblemployees = db.tblEmployees.Include(t => t.tblDepartment); //.GroupBy(x => x.FirstName) // .Select(y => new tblEmployee // { // }).ToList().OrderBy(y => y.FirstName); return View(tblemployees.ToList()); }` – DilW Oct 28 '13 at 01:55
  • This is my Action result for index i need to return view with first asc in first name then asc in last name please help – DilW Oct 28 '13 at 01:57
  • Please edit this into your question. – Gert Arnold Oct 28 '13 at 07:50

1 Answers1

0

From the code you posted in the comment you should do something like this to get the list ordered like you want.

var tblemployees = db.tblEmployees
                   .Include(t => t.tblDepartment)
                   .OrderBy(y => y.FirstName)
                   .ThenBy(x => x.LastName).ToList();
Raphael
  • 1,677
  • 1
  • 15
  • 23