Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
 public static telefon InsertTelefon(telefon t)
 {
     try
     {
         dataContext.telefon.Add(t);
         dataContext.SaveChanges();
         return(GetTelefon(t.contacteId.Value));
     }
     catch (Exception e)
     {
         return(null);
     }
 }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        public static telefon GetTelefon(int contacteID)
        {
            telefon c = dataContext.telefon.Where(x => x.contacteId == contacteID).SingleOrDefault();

            return(c);
        }