public bool UpdateClass(T_DERS t_DERS) { try { using (DBOBISEntities entities = new DBOBISEntities()) { var updateClass = entities.T_DERS.Where(x => x.DERS_KODU == t_DERS.DERS_KODU).FirstOrDefault(); if (updateClass == null) { return(false); } else { updateClass.DERS_AKADEMİSYENI = t_DERS.DERS_AKADEMİSYENI; updateClass.DERS_BLOCK = t_DERS.DERS_BLOCK; updateClass.DERS_ISMI = t_DERS.DERS_ISMI; updateClass.DERS_KODU = t_DERS.DERS_KODU; updateClass.DERS_SINIF_KOD = t_DERS.DERS_SINIF_KOD; 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; } }