Esempio n. 1
0
        public ActionResult AddStudent(int studentId)
        {
            ICourseStudentService service = CourseStudentService.GetInstance<CourseStudentRepository>();
            CourseStudent item = new CourseStudent();
            item.StudentId = studentId;
            item.CourseId = (int)Session["CurrentCourseId"];
            item = service.Insert(item);

            return Json(new { status = "ok", id = item.Id, name = item.Student.Name });
        }
Esempio n. 2
0
        private void CourseStudentGenerator()
        {
            CourseStudent cs = new CourseStudent();
            cs.CourseId = 1;
            cs.StudentId = 3;

            CourseStudent cs2 = new CourseStudent();
            cs2.CourseId = 2;
            cs2.StudentId = 3;

            CourseStudent cs3 = new CourseStudent();
            cs3.CourseId = 3;
            cs3.StudentId = 3;

            context.CourseStudents.Add(cs);
            context.CourseStudents.Add(cs2);
            context.CourseStudents.Add(cs3);
        }