public static SMaPEntities getContext() { if (applicationDbContext == null) { applicationDbContext = new SMaPEntities(); } return(applicationDbContext); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value != null) { int TeamID = (int)value; using (var dbcontext = new SMaPEntities()) { return(dbcontext.Team.Single(x => x.ID == TeamID).TeamName); } } return(""); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) { return(""); } else { Student student = (Student)value; using (var context = new SMaPEntities()) { Team studentTeam = context.Team.Where(x => x.ID == student.TeamID).FirstOrDefault(); return(String.Format("{0} ({1})", student.Users.FullName, studentTeam.TeamName)); } } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) { return(""); } else { SessionGroup sessionGroup = (SessionGroup)value; Teacher teacher; using (var dbContext = new SMaPEntities()) { teacher = dbContext.Teacher.First(x => x.ID == sessionGroup.TeacherID); return(String.Format("{0} ({1} - {2})", sessionGroup.SessionGroupName, sessionGroup.Semester.SemesterName, teacher.Users.FullName)); } } }