// מחיקה public static void DeleteScheduling(int id) { using (var context = new PARENTSEntities()) { scheduling scheduling = context.scheduling.Where(p => p.code == id).FirstOrDefault(); context.scheduling.Remove(scheduling); context.SaveChanges(); } }
//הוספת public static int AddScheduling(scheduling scheduling) { using (var context = new PARENTSEntities()) { scheduling s = context.scheduling.Add(scheduling); context.SaveChanges(); return(s.code); } }
public static scheduling GetSchedulingByIdParent(string id) { using (var context = new PARENTSEntities()) { List <studens> studens = new List <studens>(); studens = studensDAL.GetKids(id); scheduling schedulingList = context.scheduling.Where(pp => pp.id_student.Equals(studens.First())).FirstOrDefault(); return(schedulingList); } }
//עדכון כניסה public static List <scheduling> updateEnter(string id) { using (var context = new PARENTSEntities()) { scheduling scheduling = context.scheduling.Where(a => a.studens.id == id).FirstOrDefault(); scheduling.hour_enter = DateTime.Now.TimeOfDay; UpdateScheduling(scheduling); context.SaveChanges(); return(GetParentsThatWaitToClass(scheduling.code_class)); } }
//עדכון public static void UpdateScheduling(scheduling scheduling) { using (var context = new PARENTSEntities()) { scheduling s = context.scheduling.Where(x => x.code == scheduling.code).FirstOrDefault(); if (s != null) { s.code = scheduling.code; s.code_class = scheduling.code_class; s.hour_ = scheduling.hour_; s.hour_enter = scheduling.hour_enter; s.hour_exit = scheduling.hour_exit; s.hour_reach = scheduling.hour_reach; s.id_student = scheduling.id_student; context.SaveChanges(); } } }