internal IEnumerable <ContractWorker> GetJcByJobId(int jobId)
        {
            Job data = _jrepo.Get(jobId);

            if (data == null)
            {
                throw new Exception("Invalid Id");
            }
            return(_repo.GetJcByJobId(jobId));
        }
Esempio n. 2
0
        internal IEnumerable <Contractor> GetContractorsByPersonnelId(int persId)
        {
            Job valid = _jrepo.Get(persId);

            if (valid == null)
            {
                throw new Exception("Invalid Id");
            }
            return(_crepo.GetContractorsByPersonnelId(persId));
        }
        internal IEnumerable <Contractor> GetContractorsByJob(int id)
        {
            Job exists = _jrepo.Get(id);

            if (exists == null)
            {
                throw new Exception("invalid id");
            }
            return(_repo.GetContractorsByJob(id));
        }
Esempio n. 4
0
        public void Get_ShouldThrowException_WhenJobIdNotFound()
        {
            // Arrange
            using (var dbContext = new JobDbContext(CreateDbContextOptions("InMemoryDatabase_GetNull")))
            {
                var jobsRepository = new JobsRepository(SetupAutoMapper(), dbContext);
                var jobId          = Guid.Empty;

                // Act
                var exception = new Action(() => jobsRepository.Get(jobId));

                // Assert
                exception
                .Should()
                .Throw <JobNotFoundException>()
                .WithMessage(string.Format("JobId: {0} not found.", jobId));
            }
        }
Esempio n. 5
0
        public void Get_ShouldReturnJobDto()
        {
            // Arrange
            var jobDto = CreateJobDto();

            using (var dbContext = new JobDbContext(CreateDbContextOptions("InMemoryDatabase_Get")))
            {
                var jobsRepository = new JobsRepository(SetupAutoMapper(), dbContext);
                jobsRepository.Create(jobDto);

                // Act
                var job = jobsRepository.Get(jobDto.JobId);

                // Assert
                job.JobId.Should().Be(jobDto.JobId);
                job.FileName.Should().Be(jobDto.FileName);
                job.JobStatus.Should().Be(jobDto.JobStatus);
            }
        }
Esempio n. 6
0
 internal IEnumerable <Job> Get()
 {
     return(_repo.Get());
 }
 public IEnumerable <Job> Get()
 {
     return(_repo.Get());
 }
Esempio n. 8
0
 // GET: api/Jobs
 public IQueryable <Job> GetJobs()
 {
     return(jobs.Get());
 }