//הוספה מחיקה עדכון ושליפה ילדי המוסד public static void AddStudent(Student student) { using (var db = new SulamEntities()) { db.Student.Add(student); db.SaveChanges(); } }
//הוספה מחיקה עדכון ושליפה אנשי צוות public static void AddWorker(Workers worker) { using (var db = new SulamEntities()) { db.Workers.Add(worker); db.SaveChanges(); } }
public static void DeleteStudent(int studentCode) { using (var db = new SulamEntities()) { Student student = db.Student.Where(s => s.code == studentCode).First(); db.Student.Remove(student); db.SaveChanges(); } }
public static void DeleteWorker(int WorkerCode) { using (var db = new SulamEntities()) { Workers worker = db.Workers.Where(u => u.Code == WorkerCode).First(); db.Workers.Remove(worker); db.SaveChanges(); } }
public static void UpdateStudent(Student newStudent) { using (var db = new SulamEntities()) { Student student = db.Student.Where(u => u.code == newStudent.code).First(); db.Student.Remove(student); db.Student.Add(newStudent); db.SaveChanges(); } }
public static void UpdateWorker(Workers newWorker) { using (var db = new SulamEntities()) { Workers worker = db.Workers.Where(u => u.Code == newWorker.Code).First(); db.Workers.Remove(worker); db.Workers.Add(newWorker); db.SaveChanges(); } }