コード例 #1
0
        public SubmissionModel Map(SubmissionAPIModel submissionAPIModel)
        {
            if (submissionAPIModel == null)
            {
                return(null);
            }

            var studentModel = _iStudentAPIMapper.Map(submissionAPIModel.Student);
            var assignModel  = _iAssignmentAPIMapper.Map(submissionAPIModel.Assignment);

            var att = new SubmissionModel();

            att.Assignment = assignModel;
            att.Grade      = submissionAPIModel.Grade;
            att.Link       = submissionAPIModel.Link;
            att.Remark     = submissionAPIModel.Remark;
            att.Student    = studentModel;
            return(att);

            //return new SubmissionModel
            //{
            //    SubmissionStatus = Submission,
            //    Student = studentModel,
            //    Assignment = labModel
            //};

            //SubmissionModel SubmissionModel = new SubmissionModel(Submission, studentModel, labModel);

            //return SubmissionModel;
        }
コード例 #2
0
        //[ResponseType(typeof(StudentModel))]
        public IHttpActionResult Get(string username)
        {
            var result = _studentAPIMapper.Map(_studentService.GetByUsername(username));

            if (result == null)
            {
                return(NotFound());
            }

            return(Content(HttpStatusCode.OK, result));
        }
コード例 #3
0
        public AttendanceModel Map(AttendanceAPIModel attendanceAPIModel)
        {
            if (attendanceAPIModel == null)
            {
                return(null);
            }

            var attendance   = false;
            var studentModel = _iStudentAPIMapper.Map(attendanceAPIModel.Student);
            var labModel     = _iLaboratoryAPIMapper.Map(attendanceAPIModel.Laboratory);

            if (attendanceAPIModel.AttendanceStatus == "Present")
            {
                attendance = true;
            }
            else if (attendanceAPIModel.AttendanceStatus == "Absent")
            {
                attendance = false;
            }

            var att = new AttendanceModel();

            att.AttendanceStatus = attendance;
            att.Student          = studentModel;
            att.Laboratory       = labModel;
            return(att);

            //return new AttendanceModel
            //{
            //    AttendanceStatus = attendance,
            //    Student = studentModel,
            //    Laboratory = labModel
            //};

            //AttendanceModel attendanceModel = new AttendanceModel(attendance, studentModel, labModel);

            //return attendanceModel;
        }
コード例 #4
0
        public AttendanceAPIModel Map(AttendanceAPIShortModel attendanceModel)
        {
            if (attendanceModel == null)
            {
                return(null);
            }

            return(new AttendanceAPIModel
            {
                AttendanceStatus = attendanceModel.AttendanceStatus,
                Student = _iStudentAPIMapper.Map(_iStudentService.GetByUsername(attendanceModel.Username)),
                Laboratory = _iLaboratoryAPIMapper.Map(_iLaboratoryService.GetByLabNumber(attendanceModel.LabNumber))
            });
        }
コード例 #5
0
        public SubmissionAPIModel Map(SubmissionAPIShortModel submissionModel)
        {
            if (submissionModel == null)
            {
                return(null);
            }

            return(new SubmissionAPIModel
            {
                Link = submissionModel.Link,
                Grade = submissionModel.Grade,
                Remark = submissionModel.Remark,
                Student = _iStudentAPIMapper.Map(_iStudentService.GetByUsername(submissionModel.StudentUsername)),
                Assignment = _iAssignmentAPIMapper.Map(_iAssignmentService.GetByName(submissionModel.AssignmentName))
            });
        }
コード例 #6
0
ファイル: StudentController.cs プロジェクト: aledobre/Tema2
        public IEnumerable <StudentAPIModel> GetAll()
        {
            var studentModelList = _iStudentService.GetAll();
            List <StudentAPIModel> studentAPIModelList = new List <StudentAPIModel>();

            foreach (StudentModel student in studentModelList)
            {
                studentAPIModelList.Add(_iStudentAPIMapper.Map(student));
            }

            return(studentAPIModelList);
        }