internal IEnumerable <ContractWorker> GetJcByJobId(int jobId) { Job data = _jrepo.Get(jobId); if (data == null) { throw new Exception("Invalid Id"); } return(_repo.GetJcByJobId(jobId)); }
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)); }
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)); } }
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); } }
internal IEnumerable <Job> Get() { return(_repo.Get()); }
public IEnumerable <Job> Get() { return(_repo.Get()); }
// GET: api/Jobs public IQueryable <Job> GetJobs() { return(jobs.Get()); }