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(); }
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)); }
public LaboratoryModel GetById(int id) { return(_iLaboratoryMapper.Map((_iLaboratoryRepository.GetById(id)))); }
public LaboratoryModel GetById(int id) { return(mapper.map(laboratoryRepository.GetById(id))); }