public StudentViewModel(StuProfile student) { Student = student; School = db.Schools.Find(student.SchoolId); User = student.User; Trips = db.Trips .Where(t => t.Student.UserId == student.UserId) .ToList(); if (Trips.Count > 0) { Trip activeTrip = Trips .Where(t => t.IsActive == true && t.StuId == student.Id).FirstOrDefault(); if (activeTrip != null) { ActiveTrip = new TripViewModel(activeTrip); } } Upload = db.Uploads .Where(p => p.TypeRef == "ProfPic" && p.RefId == student.UserId) .FirstOrDefault(); }
public StudentViewModel(StuProfile student) { Student = student; School = db.Schools.Find(student.SchoolId); User = student.User; Trips = db.Trips .Where(t => t.Student.UserId == student.UserId) .ToList(); ActiveTrip = Trips.Where(t => t.IsActive == true).FirstOrDefault(); /*ProfPicPath = db.Uploads * .Where(p => p.RefType == "ProfPic" * && p.RefId == student.UserId) * .FirstOrDefault();*/ }