public async Task <int> AddApplicantCv(ApplicantCvInputModel inputModel) { var applicantCv = this.mapper.Map <ApplicantCV>(inputModel); if (inputModel.Picture != null) { using (var memoryStream = new MemoryStream()) { await inputModel.Picture.CopyToAsync(memoryStream); applicantCv.Picture = memoryStream.ToArray(); } } await this.applicantRepository.AddAsync(applicantCv); return(await this.applicantRepository.SaveChangesAsync()); }
public async Task <IActionResult> JoinUs(ApplicantCvInputModel inputModel) { if (ModelState.IsValid) { try { await this.applicantService.AddApplicantCv(inputModel); session.SetString(Security.SessionKeyJoinUsForm, this.joinUsSessionValue); return(this.RedirectToAction(ViewNames.AddJob)); } catch (Exception) { return(StatusCode(500, ErrorMessages.InternalServerError)); } } return(this.JoinUs()); }