// מחיקה 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(); } }
//הוספת public static int AddInstation(instation instation) { using (var context = new PARENTSEntities1()) { instation i = context.instation.Add(instation); context.SaveChanges(); return(i.code); } }
// מחיקה 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(); } }
//הוספת 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); } }
//עדכון 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(); } } }
//עדכון 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(); } } }