Beispiel #1
0
        public ActionResult <JobPositionDto> CreateJobPositionForCompany(Guid companyId, JobPositionForCreationDto dto)
        {
            if (!jobRepository.CompanyExists(companyId))
            {
                return(NotFound());
            }

            var entity = mapper.Map <JobPosition>(dto);

            jobRepository.AddJobPositionForCompany(companyId, entity);
            jobRepository.Save();

            var jobPositionDto = mapper.Map <JobPositionDto>(entity);

            return(CreatedAtRoute("GetJobPositionForCompany",
                                  new { companyId = jobPositionDto.CompanyId, jobPositionId = jobPositionDto.Id },
                                  jobPositionDto));
        }