public bool UpdateStudents(T_OGR t_OGR) { try { using (DBOBISEntities entities = new DBOBISEntities()) { var update = entities.T_OGR.Where(x => x.OGR_TC == t_OGR.OGR_TC).FirstOrDefault(); if (update == null) { return(false); } else { update.OGR_BOLUM = t_OGR.OGR_BOLUM; update.OGR_CINSIYET = t_OGR.OGR_CINSIYET; update.OGR_DOGUMT = t_OGR.OGR_DOGUMT; update.OGR_FAKULTE = t_OGR.OGR_FAKULTE; update.OGR_ISIM = t_OGR.OGR_ISIM; update.OGR_OKULNU = t_OGR.OGR_OKULNU; 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; } }