Ejemplo n.º 1
0
 public override void Map(Data.Entities.ParentCourse source, IndexModel target)
 {
     target.ParentCourseCode        = source.ParentCourseCode;
     target.ParentCourseDescription = source.ParentCourseDescription;
     target.ParentCourseTitle       = source.ParentCourseTitle;
     target.Id = source.Id;
 }
        public ParentCourseGradesModel Build(List <Data.Entities.Student> students, Data.Entities.Session session, Data.Entities.ParentCourse parentCourse)
        {
            var findParentCourseModel = _sectionToFindParentCourseModelMapper.Build(session, t =>
            {
                t.ParentCourse   = parentCourse.ParentCourseCode + " - " + parentCourse.ParentCourseTitle;
                t.ParentCourseId = parentCourse.Id;
            });

            var grades = students.SelectMany(s => s.ParentCourseGrades);

            var parentGradesModelList = grades.Select(g => _parentCourseGradeToGradeModelMapper.Build(g)).ToList();
            var studentsInParentCourseWithoutGrades = students.Where(s => s.ParentCourseGrades.IsNullOrEmpty()).ToList();

            parentGradesModelList = parentGradesModelList.Concat(studentsInParentCourseWithoutGrades.Select(s => _studentToGradeModelMapper.Build(s))).ToList();


            var parentCourseGradesModel = new ParentCourseGradesModel();

            parentCourseGradesModel.FindParentCourseModel = findParentCourseModel;
            parentCourseGradesModel.ParentGradesModelList = parentGradesModelList.ToList();

            return(parentCourseGradesModel);
        }
 public override void Map(EditModel source, Data.Entities.ParentCourse target)
 {
     target.ParentCourseCode        = source.ParentCourseCode;
     target.ParentCourseDescription = source.ParentCourseDescription;
     target.ParentCourseTitle       = source.ParentCourseTitle;
 }