I am currently returning the results of a query to an MVC view, and having a little trouble parsing the "date" (format: MM-dd-YYYY) out of the datetime datatype (format: MM-dd-YYYY hh-mm-ss) returned by my query. I was wondering if it was possible to strip off the date portion with some HTML/razor code or if I should be handling this inside my linq to entities query?
The view code is below:
@foreach(var pastSession in ViewData.Model)
{
<tr>
<td>@pastSession.Date</td>...
The query that is being returned to the controller:
var query = (from s in db.Sessions
join tuteeStudent in db.Students on s.TuteeStudentID equals tuteeStudent.StudentID
join tutorStudent in db.Students on s.TutorStudentID equals tutorStudent.StudentID
join c in db.Courses on s.CourseID equals c.CourseID
join p in db.Professors on c.ProfessorID equals p.ProfessorID
orderby s.Date
select new PastSession { Date = s.Date, Time = s.Time, Tutee = tuteeStudent.FullName, CourseNumber = c.CourseNumber, CourseName = c.CourseName, Professor = p.ProfessorLastName, Tutor = tutorStudent.FullName }).ToList();
Any advice on how to solve this problem would be much appreciated, as I don't really know which area (HTML, Razor or EF) can handle this problem.

New Topic/Question
Reply



MultiQuote





|