Exemplo n.º 1
0
        public void EditEmployeeProfile(string employeeId, int age, string aboutMe, int[] skillsId)
        {
            var employeeProfile = _employeeRepository.FindEmployeeById(employeeId);

            if (employeeProfile == null)
            {
                throw new ObjectNotFoundException($"Employee profile with id={employeeId} not found");
            }

            employeeProfile.Age     = age;
            employeeProfile.AboutMe = aboutMe;
            employeeProfile.Skills.Clear();

            foreach (var skillId in skillsId)
            {
                Skill skill = _skillRepository.FindById(skillId);

                if (skill == null)
                {
                    throw new ObjectNotFoundException($"Skill with id={skillId} not found");
                }

                employeeProfile.Skills.Add(skill);
            }

            _employeeRepository.Update(employeeProfile);
        }
Exemplo n.º 2
0
        public void AcceptOffer(int offerId, string employeeId)
        {
            var offer = _offerRepository.FindOfferById(offerId);

            if (offer == null)
            {
                throw new ObjectNotFoundException($"Offer with id={offerId} not found");
            }

            var employee = _employeeRepository.FindEmployeeById(employeeId);

            if (employee == null)
            {
                throw new ObjectNotFoundException($"Employee profile with id={employeeId} not found");
            }


            offer.OfferStatus  = OfferStatus.Accepted;
            offer.Job.Employee = employee;
            offer.Job.Status   = ProjectStatus.Closed;

            _offerRepository.Update(offer);
        }