public ActionResult ApplyNow(int id) { if (!_repo.IsExist(id)) { return(NotFound()); } var username = User.Identity.Name; var user = _jobseekerManager.GetUserAsync(User).Result; var resume = _ResumeRepositoryRepo.FindAll().FirstOrDefault(q => q.JobseekerId == user.Id); var application = new Vacancy_Application { Resume_requestid = resume.Id, vacancy_requestid = id }; var isSucess = _VacancyApplicationRepositoryRepo.Create(application); if (!isSucess) { ModelState.AddModelError("", "Something went wrong..."); return(RedirectToAction("Apply", new { id })); } return(RedirectToAction(nameof(AvailableJobs))); }
public ActionResult Create(Vacancy_ApplicationVM model) { try { if (!ModelState.IsValid) { return(View(model)); } var vacancy_Application = _mapper.Map <Vacancy_Application>(model); var isSucess = _VacancyApplicationRepositoryRepo.Create(vacancy_Application); if (!isSucess) { ModelState.AddModelError("", "Something went wrong..."); } return(RedirectToAction(nameof(Index))); } catch { ModelState.AddModelError("", "Something went wrong..."); return(View(model)); } }