public StudentList getDriverByStudID(int StudID) { StudentList driver = new StudentList(); var stud = dataContext.sp_GetDriverByStuID(StudID).First(); driver.FirstName = stud.FirstName; driver.LastName = stud.LastName; driver.Name = stud.FirstName + " " + stud.LastName; if (stud.CertifiedDriver == true) { driver.Drivertype = "Certified"; } else { driver.Drivertype = "Approved"; } return(driver); }
public IList getStudentDriverList() { List <StudentList> drivers = new List <StudentList>(); var driv = dataContext.sp_GetDrivers(); foreach (var x in driv) { StudentList driver = new StudentList(); driver.Student_ID = x.Student_ID; driver.Name = x.FirstName + " " + x.LastName; if (x.CertifiedDriver == true) { driver.Drivertype = "Certified"; } else { driver.Drivertype = "Approved"; } drivers.Add(driver); } return(drivers); }