public ActionResult EditCourse(int joinId, bool IsComplete)
        {
            var thisCourseStudent = _db.CourseStudent.FirstOrDefault(entries => entries.CourseStudentId == joinId);

            thisCourseStudent.IsComplete       = IsComplete;
            _db.Entry(thisCourseStudent).State = EntityState.Modified;
            _db.SaveChanges();

            return(RedirectToAction("Index"));
        }
 public ActionResult Edit(Student student, int id)
 {
     // if (CourseId != 0)
     // {
     //     _db.CourseStudent.Add(new CourseStudent() { CourseId = CourseId, StudentId = student.StudentId});
     // }
     _db.Entry(student).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
示例#3
0
        public ActionResult Edit(Student student, int departmentId)
        {
            var departmentStudentEntry = _db.DepartmentStudent.FirstOrDefault(x => x.StudentId == student.StudentId);

            departmentStudentEntry.DepartmentId = departmentId;
            _db.Entry(student).State            = EntityState.Modified;
            _db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult Edit(Course course, int departmentId)
        {
            var courseDepartmentEntry = _db.CourseDepartment.FirstOrDefault(x => x.CourseId == course.CourseId);

            courseDepartmentEntry.DepartmentId = departmentId;
            _db.Entry(course).State            = EntityState.Modified;
            _db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#5
0
 public ActionResult Edit(Course course)
 {
     // if (StudentId != 0)
     // {
     //   _db.CourseStudents.Add(new CourseStudent { StudentId = StudentId, CourseId = course.CourseId });
     // }
     _db.Entry(course).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
 public ActionResult Edit(Student student, int CourseId)
 {
     if (CourseId != 0)
     {
         _db.StudentCourse.Add(new StudentCourse()
         {
             CourseId = CourseId, StudentId = student.StudentId
         });
     }
     _db.Entry(student).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
示例#7
0
 public ActionResult Edit(Course course, int StudentId)
 {
     if (StudentId != 0)
     {
         _db.StudentCourse.Add(new StudentCourse()
         {
             StudentId = StudentId, CourseId = course.CourseId
         });
     }
     _db.Entry(course).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Details"));
 }
示例#8
0
 public ActionResult Edit(Student student, int[] CourseId)
 {
     if (CourseId.Length != 0)
     {
         foreach (int id in CourseId)
         {
             _db.StudentsCourses.Add(new StudentCourse()
             {
                 CourseId = id, StudentId = student.StudentId
             });
         }
     }
     _db.Entry(student).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
示例#9
0
        public ActionResult Edit(Department department, int StudentId, int CourseId)
        {
            if (StudentId != 0)
            {
                _db.StudentDepartment.Add(new StudentDepartment()
                {
                    StudentId = StudentId, DepartmentId = department.DepartmentId
                });
            }

            if (CourseId != 0)
            {
                _db.CourseDepartment.Add(new CourseDepartment()
                {
                    CourseId = CourseId, DepartmentId = department.DepartmentId
                });
            }
            _db.Entry(department).State = EntityState.Modified;
            _db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public async Task <IActionResult> PutStudent(int id, Student student)
        {
            student.StudentId = id;

            _context.Entry(student).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StudentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#11
0
        public async Task <IActionResult> PutCourse(int id, Course course)
        {
            course.CourseId = id;

            _context.Entry(course).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CourseExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
 public ActionResult Edit(Department department, int id)
 {
     _db.Entry(department).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
示例#13
0
 public ActionResult Edit(Student student)
 {
     _db.Entry(student).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
示例#14
0
 public ActionResult Edit(Course course)
 {
     _db.Entry(course).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
 public ActionResult Edit(StudentCourse sc)
 {
     _db.Entry(sc).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Details", "Courses", new { id = sc.CourseId }));
 }