// מחיקה public static void DeleteTimes(string code) { using (var context = new PARENTSEntities()) { times times = context.times.Where(p => p.code.Equals(code)).FirstOrDefault(); context.times.Remove(times); context.SaveChanges(); } }
//הוספת public static int AddTimes(times times) { using (var context = new PARENTSEntities()) { times t = context.times.Add(times); context.SaveChanges(); return(t.code); } }
//מקבל תז תלמיד public static times GetTimesForMother(string id) { using (var context = new PARENTSEntities()) { times times = context.studens.FirstOrDefault(j => j.id == id).classes.times.FirstOrDefault(); return(times); } }
//עדכון public static void UpdateTimes(times times) { using (var context = new PARENTSEntities()) { times t = context.times.Where(x => x.code == times.code).FirstOrDefault(); if (t != null) { t.code = times.code; t.code_class = times.code_class; t.from_hour = times.from_hour; t.to_hour = times.to_hour; context.SaveChanges(); } } }