public void DeleteCustomerProfile(string customerId)
        {
            var customer = _customerRepository.FindCustomerProfileById(customerId);

            if (customer == null)
            {
                throw new ObjectNotFoundException($"Customer profile with id={customerId} not found");
            }

            _customerRepository.Delete(customer);
        }
示例#2
0
        public void CreateJob(CreateJobParams jobParams)
        {
            var customerProfile = _customerRepository.FindCustomerProfileById(jobParams.CustomerId);

            if (customerProfile == null)
            {
                throw new ObjectNotFoundException($"Customer profile with id={jobParams.CustomerId} not found");
            }

            var job = new Job()
            {
                Customer       = customerProfile,
                Title          = jobParams.Title,
                Description    = jobParams.Description,
                Price          = jobParams.Price,
                PriceDiscussed = jobParams.PriceDiscussed,
                DateAdded      = DateTime.UtcNow
            };


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

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

                job.Skills.Add(skill);
            }

            _jobRepository.Create(job);
        }