Пример #1
0
        public EnrollmentViewModel Create(Enrollment entity)
        {
            _enrollmentRepository.Add(entity);
            var enrollment = _enrollmentRepository
                             .Get <Student>(
                e => e.StudentId == entity.StudentId
                );

            enrollment = _enrollmentRepository
                         .Get <Course>(
                e => e.CourseId == entity.CourseId
                );
            return(new EnrollmentViewModel()
            {
                Id = enrollment.Id,
                StudentId = enrollment.StudentId,
                CourseId = enrollment.CourseId,
                Student = enrollment.Student,
                Course = enrollment.Course
            });
        }