public JobInfo UpdateJob(int id, string status, JobUpdate jobUpdate) { var jobPost = _repo.GetOne <JobPosting>(filter: x => x.Id == id, includeProperties: $"{nameof(Client)}.{nameof(Client.User)},{nameof(JobPosting.Applications)}"); if (!string.IsNullOrEmpty(status)) { var statusToUpdate = jobPost.Status; Enum.TryParse(status, out statusToUpdate); jobPost.Status = statusToUpdate; } else if (jobUpdate != null) { jobPost.Title = jobUpdate.JobTitle; jobPost.Description = jobUpdate.Description; var currentJobType = jobPost.EmpCategory; Enum.TryParse(jobUpdate.JobType, out currentJobType); jobPost.EmpCategory = currentJobType; var currentEducation = jobPost.Education; Enum.TryParse(jobUpdate.Education, out currentJobType); jobPost.Education = currentEducation; jobPost.NeededExperience = jobUpdate.Experience; DateTime.TryParse(jobUpdate.DateFrom, out DateTime date); jobPost.DateFrom = date; DateTime.TryParse(jobUpdate.DateTo, out date); jobPost.DateTo = date; } _repo.Update(jobPost, "Admin"); return(new JobInfo().JobInformation(jobPost)); }
protected async void FireJobUpdated(JobEventArgs jobEventArgs) { var dispatcher = CoreApplication.MainView.CoreWindow.Dispatcher; await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { JobUpdate?.Invoke(this, jobEventArgs); }); }
public IActionResult Put(int id, [FromBody] JobDto dto, [FromServices] IUpdateJob command) { var newJob = new JobUpdate { Id = id, Dto = dto }; _executor.ExecuteCommand(command, newJob); return(StatusCode(StatusCodes.Status204NoContent)); }
public IActionResult UpdateJob(JobUpdate jobSubmit) { var result = _jobManager.UpdateJob(jobSubmit); if (result.Succeeded) { return(Ok(result)); } else { return(BadRequest(result)); } }
public ActionResult <JobUpdate> UpdateJob(int id, JobUpdate jobUpdate) { var jobModel = _data.GetJobById(id); if (jobModel == null) { return(NotFound()); } _mapper.Map(jobUpdate, jobModel); _data.UpdateJob(jobModel); _data.SaveChanges(); return(NoContent()); }
public void Execute(JobUpdate request) { _validation.ValidateAndThrow(request.Dto); var job = _context.Jobs .Include(j => j.JobCategories).ThenInclude(c => c.Category) .Include(j => j.JobLocations).ThenInclude(l => l.Location) .FirstOrDefault(j => j.Id == request.Id); if (job == null) { throw new EntityNotFoundException(request.Id, typeof(Domain.Job)); } job.JobName = request.Dto.JobName; job.JobResponsibilities = request.Dto.JobResponsibilities; job.JobRequirments = request.Dto.JobRequirments; job.JobDescription = request.Dto.JobDescription; job.WorktimeId = (Worktime)request.Dto.WorktimeId; job.WorktimeDescription = request.Dto.WorktimeDescription; job.PaymentId = (Payment)request.Dto.PaymentId; job.PaymentDescription = request.Dto.PaymentDescription; job.EndDate = request.Dto.EndDate; job.IsFeatured = request.Dto.IsFeatured; job.IsPremium = request.Dto.IsPremium; job.JobCategories.Clear(); foreach (var category in request.Dto.Categories) { job.JobCategories.Add(new JobCategory { CategoryId = category.Id }); } job.JobLocations.Clear(); foreach (var location in request.Dto.Locations) { job.JobLocations.Add(new JobLocation { LocationId = location.Id, DetailedLocation = location.DetailedLocation }); } _context.SaveChanges(); }
public GeneralResponse UpdateJob(JobUpdate jobUpdate) { var response = new GeneralResponse(); var jobPost = GetOne <JobPosting>(filter: x => x.Id == jobUpdate.Id, includeProperties: $"{nameof(Client)}.{nameof(Client.User)},{nameof(JobPosting.Applications)}"); if (jobPost == null) { return(response.ErrorHandling <JobManager>(ErrorConstants.NullValue, objects: jobPost)); } if (!string.IsNullOrEmpty(jobUpdate.Status)) { bool statusParse = Enum.TryParse(jobUpdate.Status, out JobPostingStatus statusToUpdate); if (!statusParse) { return(response.ErrorHandling(ErrorConstants.InvalidInput, _logger, jobUpdate.Status)); } jobPost.Status = statusToUpdate; } else { jobPost = _mapper.Map(jobUpdate, jobPost); bool jobTypeParse = Enum.TryParse(jobUpdate.JobType, out JobType currentJobType); bool educationParse = Enum.TryParse(jobUpdate.Education, out EducationType currentEducation); bool dateFromParse = DateTime.TryParse(jobUpdate.DateFrom, out DateTime dateFrom); bool dateToParse = DateTime.TryParse(jobUpdate.DateTo, out DateTime dateTo); if (!jobTypeParse || !educationParse || !dateToParse || !dateToParse || dateFrom > dateTo) { return(response.ErrorHandling(ErrorConstants.InvalidInput, _logger, dateFrom, dateTo, currentEducation, currentJobType)); } jobPost.DateTo = dateTo; jobPost.DateFrom = dateFrom; jobPost.EmpCategory = currentJobType; jobPost.Education = currentEducation; } Update(jobPost, RoleConstants.ADMIN); response.Succeeded = true; return(response); }
private void Worker_ProgressChanged(object sender, ProgressChangedEventArgs e) { JobProgressUpdateEventArgs jobArgs = new JobProgressUpdateEventArgs(currentJob.Id, currentJob.Type, currentJob.State, e.ProgressPercentage); JobUpdate?.Invoke(sender, jobArgs); }
public ActionResult <JobInfo> UpdateJob(int id, [FromQuery] string status, [FromBody] JobUpdate jobSubmit) { return(Ok(_jobManager.UpdateJob(id, status, jobSubmit))); }
public object JobsCreateOrUpdate(JobUpdate update) { return(Status(Jobs.Update(update.Token, new StoredJob(update.Token.User, update.NewValues)))); }