Пример #1
0
        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());
        }
Пример #2
0
        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
            }));
        }
Пример #3
0
        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));
        }