示例#1
0
        public SubmissionModel Map(SubmissionDTO submissionDTO)
        {
            if (submissionDTO == null)
            {
                return(null);
            }

            submissionDTO.Student    = _iStudentMapper.Map(_iStudentService.GetById(submissionDTO.StudentId));
            submissionDTO.Assignment = _iAssignmentMapper.Map(_iAssignmentService.GetById(submissionDTO.AssignmentId));

            var studentModel = _iStudentMapper.Map(submissionDTO.Student);
            var assigModel   = _iAssignmentMapper.Map(submissionDTO.Assignment);

            return(new SubmissionModel
            {
                Id = submissionDTO.Id,
                StudentId = studentModel.Id,
                Student = studentModel,
                AssignmentId = assigModel.Id,
                Assignment = assigModel,
                Link = submissionDTO.Link,
                Remark = submissionDTO.Remark,
                Grade = submissionDTO.Grade
            });
        }
示例#2
0
        public void AddAssignment(AssignmentModel assignmentModel)
        {
            var assign = _iAssignmentMapper.Map(assignmentModel);

            _iAssignmentRepository.Add(assign);
            _iAssignmentRepository.SaveChanges();
        }
示例#3
0
 public void Add(AssignmentModel assignmentModel)
 {
     aRepo.Add(aMapper.Map(assignmentModel));
 }