public async Task <int> AddApplicantEducation(EducationInputModel inputModel) { var currentApplicant = this.applicantRepository.All().LastOrDefault(); var education = this.mapper.Map <Education>(inputModel); if (currentApplicant != null) { education.ApplicantCVId = currentApplicant.Id; } await this.educationRepository.AddAsync(education); return(await this.educationRepository.SaveChangesAsync()); }
public ActionResult AddEducation(EducationInputModel model) { if (!this.ModelState.IsValid) { return(this.View(model)); } var cv = this.cvs.GetChoosen().FirstOrDefault(); var education = this.Mapper.Map <Education>(model); cv.Educations.Add(education); this.cvs.Update(); return(this.View("AddCourse", new EducationIdViewModel() { Id = education.Id })); }
public async Task <IActionResult> AddEducation(EducationInputModel inputModel) { if (ModelState.IsValid) { try { await this.applicantService.AddApplicantEducation(inputModel); TempData[SuccessMessages.TempDataSuccessEducationKey] = SuccessMessages.EducationSuccessMessage; return(this.RedirectToAction()); } catch (Exception) { return(StatusCode(500, ErrorMessages.InternalServerError)); } } return(this.View(inputModel)); }