public void AddQualificationForTeamMember(Qualification qualification, int userId) { var user = _userRepository.GetById(userId); qualification.User = user; var newQual = _qualificationRepository.Add(qualification); if (newQual.Type == CertificateCourseType.FA) { _qualificationToFaCourseRepository.Add(new QualificationToFaCourse() { FaCourse = _faCourseRepository.Get(f=>f.Name.ToLower() == newQual.Name.ToLower()), Qualification = newQual }); } }
public void UpdateQualification(Qualification qualification, int id) { qualification.Id = id; _qualificationRepository.Update(qualification,qualification.Id); if (qualification.Type == CertificateCourseType.FA) { var faC = _qualificationToFaCourseRepository.Get( q => q.FaCourse.Name.ToLower() == qualification.Name.ToLower()); if (faC == null) { _qualificationToFaCourseRepository.Add(new QualificationToFaCourse() { FaCourse = _faCourseRepository.Get(f => f.Name.ToLower() == qualification.Name.ToLower()), Qualification = qualification }); } } else { _qualificationToFaCourseRepository.Delete(q=>q.Qualification.Id == qualification.Id); } }