Exemple #1
0
 public void AddAssignment(AssignmentModel assignment)
 {
     if (laboratoryRepository.GetById(assignment.Laboratory.Id) == null)
     {
         throw new Exception("lab not present");
     }
     assignmentRepository.Add(Mapper.Map <AssignmentDto>(assignment));
     assignmentRepository.Save();
 }
Exemple #2
0
        public void AddAttendance(AttendanceModel attendance)
        {
            var lab     = laboratoryRepository.GetById(attendance.Lab.Id);
            var student = userRepository.GetById(attendance.Student.Id);

            if (student == null)
            {
                throw new Exception("no student with such id");
            }
            if (lab == null)
            {
                throw new Exception("no lab wiht such id");
            }
            attendanceRepository.Add(new AttendanceDto {
                LaboratoryId = lab.Id, UserId = student.Id
            });
            attendanceRepository.Save();
        }
 public void DeleteLaboratory(int id)
 {
     labRepo.Delete(labRepo.GetById(id));
 }
Exemple #4
0
 public LaboratoryModel GetById(int id)
 {
     return(_iLaboratoryMapper.Map((_iLaboratoryRepository.GetById(id))));
 }
Exemple #5
0
 public LaboratoryModel GetById(int id)
 {
     return(mapper.map(laboratoryRepository.GetById(id)));
 }