public ResponseViewModel UpdateJob(JobInputModel job) { var mappedResult = _jobRepository.UpdateJob(_mapper.Map <JobInputModel, Job>(job)); var result = _mapper.Map <Job, JobViewModel>(mappedResult); return(Ok(result)); }
public IActionResult UpdateJob([FromBody] JobInputModel job) { if (!ModelState.IsValid) { return(BadRequest()); } return(Ok(_jobAppService.UpdateJob(job))); }
public IActionResult CreateJob([FromBody] JobInputModel model) { if (!ModelState.IsValid) { return(BadRequest()); } return(Ok(_jobAppService.CreateNewJob(model).Result)); }
public async Task <int> AddApplicantJob(JobInputModel inputModel) { var currentApplicant = this.applicantRepository.All().LastOrDefault(); var job = this.mapper.Map <Job>(inputModel); if (currentApplicant != null) { job.ApplicantCVId = currentApplicant.Id; } await this.jobRepository.AddAsync(job); return(await this.jobRepository.SaveChangesAsync()); }
public async Task <IActionResult> AddJob(JobInputModel model) { if (ModelState.IsValid) { var currentApplicantId = Convert.ToInt32(TempData[StringConstants.TempDataApplicantIdKey]); await this.applicantService.AddApplicantJobAsync(model, currentApplicantId); TempData[TempDataKeys.TempDataSuccessJobKey] = SuccessMessages.JobSuccessMessage; TempData.Remove(TempDataKeys.TempDataJoinUsWorkFlowKey); } return(RedirectToAction(StringConstants.AddJobAndEducation, StringConstants.Applicant)); }
public async Task <IActionResult> Create(JobInputModel input) { if (!this.stringValidator.IsStringValid(input.JobBody, BodyMinLength)) { this.ModelState.AddModelError("Error", EmptyBody); } if (!this.ModelState.IsValid) { return(this.View(input)); } var userId = this.userManager.GetUserId(this.User); await this.jobService.CreateAsync(input, userId); return(this.RedirectToAction(nameof(this.All))); }
public async Task <ResponseViewModel> CreateNewJob(JobInputModel model) { //var jobStatus = _jobRepository.GetJobStatuses().FirstOrDefault(x => x.Id == model.JobStatusId); //if(jobStatus == null) //{ // return Failed(ResponseMessageViewModel.INVALID_JOB_STATUS, ResponseErrorCodeStatus.INVALID_JOB_STATUS); //} var jobType = _jobRepository.GetJobTypes().FirstOrDefault(x => x.Id == model.JobTypeId); //model.ValidityPeriod = DateTime.Now; if (jobType == null) { return(Failed(ResponseMessageViewModel.INVALID_JOB_TYPE, ResponseErrorCodeStatus.INVALID_JOB_TYPE)); } var mappedResult = _mapper.Map <JobInputModel, Job>(model); var user = _userService.GetCurrentLoggedOnUserAsync().Result; mappedResult.AppUserId = user.Id; FileDocument uploadResult = FileDocument.Create(); try { uploadResult = await BaseContentServer .Build(ContentServerTypeEnum.FIREBASE, _settings) .UploadDocumentAsync(FileDocument.Create(model.Document, "Job", $"{user.GUID}", FileDocumentType.GetDocumentType(MIMETYPE.IMAGE))); mappedResult.Document = uploadResult.Path; } catch (Exception e) { return(Failed(ResponseMessageViewModel.ERROR_UPLOADING_FILE, ResponseErrorCodeStatus.ERROR_UPLOADING_FILE)); } var result = _mapper.Map <Job, JobViewModel>(_jobRepository.CreateJob(mappedResult)); return(Ok(result)); }
public async Task <IActionResult> AddJob(JobInputModel jobInputModel) { if (ModelState.IsValid) { try { await this.applicantService.AddApplicantJob(jobInputModel); TempData[SuccessMessages.TempDataSuccessJobKey] = SuccessMessages.JobSuccessMessage; return(this.RedirectToAction()); } catch (Exception) { return(StatusCode(500, ErrorMessages.InternalServerError)); } } return(this.View(jobInputModel)); }
public async Task <int> AddApplicantJobAsync(JobInputModel model, int currentApplicantId) { Job job = null; try { job = this.mapper.Map <Job>(model); job.ApplicantCVId = currentApplicantId; await this.jobRepository.AddAsync(job); await this.jobRepository.SaveChangesAsync(); this.logger.LogInformation(LogMessages.UserAddedJob); } catch (Exception e) { throw new ApplicationException(e.Message); } return(job.Id); }
public Task <ResponseViewModel> CreateNewJobAsync(JobInputModel job) { throw new NotImplementedException(); }