Ejemplo n.º 1
0
        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;
         }
     }
 }
Ejemplo n.º 4
0
 public void UpdateStudent(Student student)
 {
     context.Entry(student).State = EntityState.Modified;
 }
Ejemplo n.º 5
0
 public void InsertStudent(Student student)
 {
     context.Students.Add(student);
 }