public void AddStudent(Student s) { using (StudentsEntities context = new StudentsEntities()) { context.Students.Add(s); context.SaveChanges(); } }
public void DeleteStudentById(string id) { using (StudentsEntities context = new StudentsEntities()) { foreach (Student s in context.Students) { if (s.Id == id) { context.Students.Remove(s); } } context.SaveChanges(); } }