public void DeleteStudent(int Id) { var Student = registerContext.Students.Where(x => x.Id == Id).FirstOrDefault(); registerContext.Remove(Student); registerContext.SaveChanges(); }