Example #1
0
        public void Update(StudentDTO recDTO)
        {
            Student student = _studentRepository.Find(recDTO.StudentID);

            if (student == null)
            {
                throw new DataException(string.Format(ValidationConstants.SDataNotFoundWithValue, "Student", recDTO.StudentID));
            }

            student = StudentMapper.Map(recDTO);
            _studentRepository.Update(student);
        }
Example #2
0
        public List <StudentDTO> FindStudents(StudentFindCriteria criteria)
        {
            if (criteria == null)
            {
                throw new ArgumentNullException("criteria");
            }

            var students             = _studentRepository.FindByCriteria(criteria);
            List <StudentDTO> result = new List <StudentDTO>();

            foreach (var student in students)
            {
                result.Add(StudentMapper.Map(student));
            }

            return(result);
        }
Example #3
0
        public StudentDTO Find(int studentID)
        {
            if (studentID == 0)
            {
                throw new ArgumentException("StudentID");
            }

            Student student = _studentRepository.Find(studentID);

            if (student == null)
            {
                return(null);
            }

            StudentDTO recDTO = StudentMapper.Map(student);

            return(recDTO);
        }
Example #4
0
        public void Add(StudentDTO recDTO)
        {
            Student student = StudentMapper.Map(recDTO);

            _studentRepository.Add(student);
        }