Beispiel #1
0
        public string Select(Course item)
        {
            CourseCheckState courseCheckState = new CourseCheckState
            {
                IsValidate = true
            };

            Student student = _studentDao.GetAll().SingleOrDefault(x => x.Id == item.StudentId);

            List <Course> courseSelected = _courseDao.GetAll().Where(x => x.StudentId == student.Id).ToList();

            student.Courses = courseSelected;

            courseCheckState.CourseSelect = new CourseSelect {
                Student = student,
                Course  = item
            };

            _courseValidation.Check(courseCheckState);

            if (!courseCheckState.IsValidate)
            {
                return(courseCheckState.Message);
            }

            _courseDao.Create(item);

            return("Course Select Success");
        }