Ejemplo n.º 1
0
        //[ResponseType(typeof(LaboratoryModel))]
        public IHttpActionResult GetByNumber(int labNumber)
        {
            var result = _laboratoryAPIMapper.Map(_laboratoryService.GetByLabNumber(labNumber));

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

            return(Content(HttpStatusCode.OK, result));
        }
Ejemplo n.º 2
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))
            });
        }
Ejemplo n.º 3
0
        public AssignmentAPIModel Map(AssignmentAPIShortModel assignmentModel)
        {
            if (assignmentModel == null)
            {
                return(null);
            }

            return(new AssignmentAPIModel
            {
                Name = assignmentModel.Name,
                Laboratory = _iLaboratoryAPIMapper.Map(_iLaboratoryService.GetByLabNumber(assignmentModel.LabNumber)),
                Deadline = assignmentModel.Deadline,
                Description = assignmentModel.Description
            });
        }
Ejemplo n.º 4
0
        public AssignmentDTO Map(AssignmentModel assignmentModel)
        {
            if (assignmentModel == null)
            {
                return null;
            }

            var laboratory = _iLaboratoryService.GetByLabNumber(assignmentModel.Laboratory.LabNumber);

            var labDTO = _iLaboratoryMapper.Map(assignmentModel.Laboratory);

            return new AssignmentDTO
            {
                Id = assignmentModel.Id,
                Name = assignmentModel.Name,
                Deadline = assignmentModel.Deadline,
                LabId = assignmentModel.Laboratory.Id,
                Description = assignmentModel.Description,
                Laboratory = labDTO
            };
        }
Ejemplo n.º 5
0
        public AttendanceDTO Map(AttendanceModel attendanceModel)
        {
            if (attendanceModel == null)
            {
                return(null);
            }

            var student    = _iStudentService.GetByUsername(attendanceModel.Student.Username);
            var laboratory = _iLaboratoryService.GetByLabNumber(attendanceModel.Laboratory.LabNumber);

            //var studentDTO = _iStudentMapper.Map(attendanceModel.Student);
            //var labDTO = _iLaboratoryMapper.Map(attendanceModel.Laboratory);

            return(new AttendanceDTO
            {
                AttendanceStatus = attendanceModel.AttendanceStatus,
                //Student = studentDTO,
                //Laboratory = labDTO,
                Id = attendanceModel.Id,
                LabId = laboratory.Id,
                StudentId = student.Id
            });
        }