public ViewResult Create(Student newStudent) { _repository.InsertStudent(newStudent); _repository.Save(); return View("Create"); }
public void InsertStudent(Student student) { if (ExceptionToThrow != null) { throw ExceptionToThrow; } _db.Add(student); }
public void UpdateStudent(Student student) { foreach (var person in _db) { if(person.PersonId == student.PersonId) { _db.Remove(student); _db.Add(student); return; } } }
public void UpdateStudent(Student student) { context.Entry(student).State = EntityState.Modified; }
public void InsertStudent(Student student) { context.Students.Add(student); }