public bool delStudents(long ogr_TC)
 {
     try
     {
         using (DBOBISEntities entities = new DBOBISEntities())
         {
             var delstudentkeytable = entities.T_KEY.Where(x => x.OGR_OKULNU == ogr_TC).FirstOrDefault();
             var delstudenttable    = entities.T_OGR.Where(x => x.OGR_TC == ogr_TC).FirstOrDefault();
             if (delstudenttable == null)
             {
                 return(false);
             }
             else
             {
                 if (delstudentkeytable != null)
                 {
                     entities.T_KEY.Remove(delstudentkeytable);
                     entities.T_OGR.Remove(delstudenttable);
                     entities.SaveChanges();
                     return(true);
                 }
                 else
                 {
                     entities.T_OGR.Remove(delstudenttable);
                     entities.SaveChanges();
                     return(true);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public bool delClass(string classNu)
 {
     try
     {
         using (DBOBISEntities entities = new DBOBISEntities())
         {
             var delClass     = entities.T_DERS.Where(x => x.DERS_KODU == classNu).FirstOrDefault();
             var checkStudent = entities.T_KEY.Where(x => x.DERS_KODU == classNu).FirstOrDefault();
             if (delClass == null)
             {
                 return(false);
             }
             else
             {
                 if (checkStudent != null)
                 {
                     return(false);
                 }
                 else
                 {
                     entities.T_DERS.Remove(delClass);
                     entities.SaveChanges();
                     return(true);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public bool AddNewStudents(T_OGR t_OGR, T_KEY t_KEY)
 {
     try
     {
         using (DBOBISEntities entities = new DBOBISEntities())
         {
             var check = entities.T_OGR.Where(x => x.OGR_TC == t_OGR.OGR_TC).FirstOrDefault();
             if (check != null)
             {
                 return(false);
             }
             else
             {
                 entities.T_OGR.Add(t_OGR);
                 entities.T_KEY.Add(t_KEY);
                 entities.SaveChanges();
                 return(true);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public bool AddnewClass(T_DERS t_DERS)
 {
     try
     {
         using (DBOBISEntities entities = new DBOBISEntities())
         {
             var check = entities.T_DERS.Where(x => x.DERS_KODU == t_DERS.DERS_KODU).FirstOrDefault();
             if (check != null)
             {
                 return(false);
             }
             else
             {
                 entities.T_DERS.Add(t_DERS);
                 entities.SaveChanges();
                 return(true);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }