Exemplo n.º 1
0
        // מחיקה

        public static void DeleteInstation(int code)
        {
            using (var context = new PARENTSEntities1())
            {
                instation instation = context.instation.Where(p => p.code == code).FirstOrDefault();
                context.instation.Remove(instation);
                context.SaveChanges();
            }
        }
Exemplo n.º 2
0
 //הוספת
 public static int AddInstation(instation instation)
 {
     using (var context = new PARENTSEntities1())
     {
         instation i = context.instation.Add(instation);
         context.SaveChanges();
         return(i.code);
     }
 }
Exemplo n.º 3
0
        // מחיקה

        public static void DeleteClass(int code)
        {
            using (var context = new PARENTSEntities1())
            {
                classes classes = context.classes.Where(p => p.code == code).FirstOrDefault();
                context.classes.Remove(classes);
                context.SaveChanges();
            }
        }
Exemplo n.º 4
0
        //הוספת
        public static int AddClass(classes classes)
        {
            using (var context = new PARENTSEntities1())
            {
                context.Database.ExecuteSqlCommand("set identity_insert [dbo].[classes] on");

                classes c = context.classes.Add(classes);
                context.SaveChanges();
                context.Database.ExecuteSqlCommand("set identity_insert [dbo].[classes] of");

                return(c.code);
            }
        }
Exemplo n.º 5
0
 //עדכון
 public static void UpdateClass(classes classes)
 {
     using (var context = new PARENTSEntities1())
     {
         classes pro = context.classes.Where(p => p.code == classes.code).FirstOrDefault();
         if (pro != null)
         {
             pro.code       = classes.code;
             pro.num_class  = classes.num_class;
             pro.id_teacher = classes.id_teacher;
             context.SaveChanges();
         }
     }
 }
Exemplo n.º 6
0
 //עדכון
 public static void UpdateInstation(instation instation)
 {
     using (var context = new PARENTSEntities1())
     {
         instation pro = context.instation.Where(p => p.code == instation.code).FirstOrDefault();
         if (pro != null)
         {
             pro.code     = instation.code;
             pro.email    = instation.email;
             pro.NAME     = instation.NAME;
             pro.password = instation.password;
             context.SaveChanges();
         }
     }
 }