internal void Delete(int id) { using (GlobalDBContext dBContext = new GlobalDBContext()) { Student student = dBContext.Student(true) .Where(s => s.ID == id) .FirstOrDefault(); if (student != null) { dBContext.Remove(student); dBContext.SaveChanges(); } } }