public static parents GetParentById(string id) { using (var context = new PARENTSEntities()) { parents parentList = context.parents.FirstOrDefault(x => x.id == id); return(parentList); } }
// מחיקה public static void DeleteParents(string id) { using (var context = new PARENTSEntities()) { parents parents = context.parents.Where(p => p.id.Equals(id)).FirstOrDefault(); context.parents.Remove(parents); context.SaveChanges(); } }
//הוספת public static string AddParents(parents parents) { using (var context = new PARENTSEntities()) { parents p = context.parents.Add(parents); context.SaveChanges(); return(p.id); } }
public static parents GetParentByIdStudent(string id) { using (var context = new PARENTSEntities()) { studens student = context.studens.Where(s => s.id == id).FirstOrDefault(); parents parentList = context.parents.Where(p => p.id == student.id_parent).FirstOrDefault(); return(parentList); } }
//עדכון public static void UpdateParents(parents parents) { using (var context = new PARENTSEntities()) { parents p = context.parents.Where(x => x.id == parents.id).FirstOrDefault(); if (p != null) { p.id = parents.id; p.first_name = parents.first_name; p.code_instation = parents.code_instation; p.email = parents.email; p.last_name = parents.last_name; p.telefone = parents.telefone; context.SaveChanges(); } } }