Пример #1
0
 public ActionResult Edit(Student student)
 {
     if (ModelState.IsValid)
     {
         db.Entry(student).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(student);
 }
Пример #2
0
Файл: Unit.cs Проект: rtw/SARMS
        public Enrollment EnrollStudent(Student student)
        {
            var enrollment = new Enrollment();
            enrollment.Unit = this;
            enrollment.Student = student;

            Enrollments.Add(enrollment);
            student.Enrollments.Add(enrollment);

            return enrollment;
        }
Пример #3
0
        public ActionResult Create(Student student)
        {
            if (ModelState.IsValid)
            {
                db.Students.Add(student);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(student);
        }