示例#1
0
 public static List <ClassDTO> GetClasses()
 {
     using (Entities e = new Entities())
     {
         return(ClassCasting.ClassesToDTO(e.classes.ToList()));
     }
 }
示例#2
0
 public static List <ClassDTO> GetClassesByTeacherId(int teacherId)
 {
     using (Entities e = new Entities())
     {
         try
         {
             var classes = e.classes.Where(c => c.teacher_id == teacherId).ToList();
             if (classes != null)
             {
                 return(ClassCasting.ClassesToDTO(classes));
             }
             throw new Exception("no classes");
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }