public static void DeleteTelefon(int id) { telefon c = dataContext.telefon.Where(x => x.contacteId == id).SingleOrDefault(); if (c != null) { dataContext.telefon.Remove(c); dataContext.SaveChanges(); } }
public static telefon InsertTelefon(telefon t) { try { dataContext.telefon.Add(t); dataContext.SaveChanges(); return(GetTelefon(t.contacteId.Value)); } catch (Exception e) { return(null); } }
public static telefon UpdateTelefon(int id, telefon c) { try { telefon c0 = dataContext.telefon.Where(x => x.contacteId == id).SingleOrDefault(); if (c.telefon1 != null) { c0.telefon1 = c.telefon1; } if (c.tipus != null) { c0.tipus = c.tipus; } dataContext.SaveChanges(); return(GetTelefon(id)); } catch (Exception e) { return(null); } }
public static telefon GetTelefon(int contacteID) { telefon c = dataContext.telefon.Where(x => x.contacteId == contacteID).SingleOrDefault(); return(c); }