Beispiel #1
0
        public async Task <IActionResult> UpdateJobQueue(int queueId, UpdateJobDto job)
        {
            if (!await CheckEngineStatus())
            {
                return(Unauthorized());
            }

            _logger.LogRequest("Updating job queue. Request body: {@job}", job);

            try
            {
                if (queueId != job.Id)
                {
                    return(BadRequest("Queue Id doesn't match."));
                }

                var entity = _mapper.Map <JobQueue>(job);
                await _jobQueueService.UpdateJobQueue(entity);


                _logger.LogResponse("Job queue {queueId} updated", queueId);

                return(Ok());
            }
            catch (JobProcessedByOtherEngineException ex)
            {
                _logger.LogWarning(ex, "Job is processed by other engine");
                return(BadRequest(ex.Message));
            }
        }
        public bool Update(UpdateJobDto updateJobDto)
        {
            var dbJob = _context.Jobs.Find(updateJobDto.Id);

            dbJob = _mapper.Map <UpdateJobDto, Job>(updateJobDto, dbJob);
            _context.SaveChanges();
            return(true);
        }
        public async Task <IActionResult> PutJob(UpdateJobDto updatedJob)
        {
            ServiceResponse <GetJobDto> response = await _resumeService.UpdateJob(updatedJob);

            if (response.Data == null)
            {
                return(NotFound(response));
            }
            return(Ok(response));
        }
Beispiel #4
0
        public async Task <IActionResult> UpdateJobQueue(int projectId, int queueId, UpdateJobDto job)
        {
            _logger.LogInformation("Update job queue {queueId} in project {projectId}", queueId, projectId);

            if (queueId != job.Id)
            {
                return(BadRequest("Queue Id doesn't match."));
            }

            var entity = _mapper.Map <JobQueue>(job);

            entity.ProjectId = projectId;
            await _jobQueueService.UpdateJobQueue(entity);

            return(Ok());
        }
        public async Task <ServiceResponse <GetJobDto> > UpdateJob(UpdateJobDto updatedJob)
        {
            ServiceResponse <GetJobDto> response = new ServiceResponse <GetJobDto>();

            try
            {
                Job job = await _context.Jobs.FirstOrDefaultAsync(j => j.Id == updatedJob.Id);

                job.Company   = updatedJob.Company;
                job.Title     = updatedJob.Title;
                job.StartDate = updatedJob.StartDate;
                job.EndDate   = updatedJob.EndDate;

                response.Data = _mapper.Map <GetJobDto>(job);
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }
            return(response);
        }
Beispiel #6
0
        public async Task <CoreJobDto> Update(UpdateJobDto job)
        {
            using (var db = _contextFactory.CreateDb())
            {
                var efJob = db.Jobs.Single(x => x.JobId == job.JobId);
                efJob.ClientId    = job.ClientId;
                efJob.JobCode     = job.JobCode;
                efJob.JobName     = job.JobName;
                efJob.SiteId      = job.SiteId;
                efJob.TargetHours = job.TargetHours;
                efJob.JobStatusId = (int)job.JobStatusId;
                efJob.EmployeeId  = job.ProjectManagerEmployeeId;
                if (job.JobStatusId == Jobs.JobStatus.Archived)
                {
                    var toRemove = await db.EmployeeJobs.Where(x => x.JobId == job.JobId).ToArrayAsync();

                    db.EmployeeJobs.RemoveRange(toRemove);
                }
                await db.SaveChangesAsync();

                return((await GetForJobId(efJob.JobId)).CoreInfo);
            }
        }
Beispiel #7
0
        public async Task UpdateJobQueue(int queueId, UpdateJobDto job)
        {
            var path = $"queue/{queueId}";

            await Api.Put(path, job);
        }
Beispiel #8
0
        public async Task UpdateJobQueue(int projectId, int queueId, UpdateJobDto job)
        {
            var path = $"project/{projectId}/queue/{queueId}";

            await Api.Put(path, job);
        }