public IHttpActionResult ListApplications(string key) { if (key != AUTHKEY) { return(StatusCode(HttpStatusCode.InternalServerError)); } List <JobApplicationsModel> allApplicationsList = db.JobApplications.OrderBy(a => a.PostingId).ThenByDescending(a => a.ApplicationDate).ToList(); List <JobApplicationViewModel> allApplicationsViewModelList = new List <JobApplicationViewModel> { }; foreach (var element in allApplicationsList) { JobApplicationViewModel jobApplication = new JobApplicationViewModel { ApplicationId = element.ApplicationId, PostingId = element.PostingId, ApplicationDate = element.ApplicationDate, ApplicantFirstName = element.ApplicantFirstName, ApplicantLastName = element.ApplicantLastName, ApplicantEmail = element.ApplicantEmail, ApplicantPhone = element.ApplicantPhone == null || element.ApplicantPhone == "" ? "N/A" : element.ApplicantPhone, CvPath = element.CvPath }; allApplicationsViewModelList.Add(jobApplication); } return(Ok(allApplicationsViewModelList)); }
public ActionResult JobApplication(JobApplicationViewModel jobApplication) { if (ModelState.IsValid) { var jobId = jobApplication.Job.JobId; var jobSeekerId = jobApplication.JobSeekerId; var expectedsalary = jobApplication.ExpectedSalary; var appliedJob = new AppliedJob() { JobId = jobId, JobSeekerId = jobSeekerId, ExpectedSalary = expectedsalary, DateOfApplication = DateTime.Now }; var isApplicationSuccessful = Repository.ApplyForJob(appliedJob); if (!isApplicationSuccessful) { Session.Add("message", "Your application for the job could not be completed!"); return(RedirectToAction("JobApplication", "JobSeeker", new { @id = jobId })); } Session.Add("message", "Your have successfully applied for the following post:"); return(RedirectToAction("ConfirmJobApplication", "JobSeeker", new { @id = jobId })); } return(View(jobApplication)); }
/// <summary> /// Adding new Active-Job Application for proceeding /// </summary> /// <param name="Cid"></param> /// <returns></returns> public async Task <IActionResult> AddNewJobApplications(int Cid) { //checking if candidate job application already exists try { var isRepeating = _dbContext.jobApplications.Where(x => x.candidateId == Cid).Any(); if (isRepeating) { TempData["msg"] = getCandidateNameById(Cid); return(RedirectToAction("Index", "JobApplication", new { conflict = TempData["msg"] })); } }catch (Exception ex) { Console.WriteLine(ex.Message); } //create jobapplication JobApplicationViewModel model = new JobApplicationViewModel(); model.candidateId = Cid; model.round = 0; model.status = status_Pending; model.notified = false; try { await _jobApplicationPage.AddJobApplications(model); } catch (Exception ex) { Console.WriteLine(ex.Message); } return(RedirectToAction("Index", "JobApplication")); }
public async Task <IActionResult> Details(int?id) { if (id == null) { return(NotFound()); } var jobApplication = await _context.JobApplications .FirstOrDefaultAsync(m => m.Id == id); if (jobApplication == null) { return(NotFound()); } JobApplicationViewModel model = jobApplication; var jobOffer = await _context.JobOffers.FirstOrDefaultAsync(m => m.Id == model.OfferId); if (jobOffer == null) { return(NotFound()); } model.JobTitle = jobOffer.JobTitle; model.CompanyName = jobOffer.CompanyName; model.Location = jobOffer.Location; return(View(model)); }
public IHttpActionResult ApplicationDetails(string key, int id) { if (key != AUTHKEY) { return(StatusCode(HttpStatusCode.InternalServerError)); } JobApplicationsModel applicationModel = new JobApplicationsModel(); applicationModel = db.JobApplications.Find(id); JobApplicationViewModel applicationViewModel = new JobApplicationViewModel(); applicationViewModel.ApplicationId = applicationModel.ApplicationId; applicationViewModel.PostingId = applicationModel.PostingId; applicationViewModel.ApplicationDate = applicationModel.ApplicationDate; applicationViewModel.ApplicantFirstName = applicationModel.ApplicantFirstName; applicationViewModel.ApplicantLastName = applicationModel.ApplicantLastName; applicationViewModel.ApplicantEmail = applicationModel.ApplicantEmail; applicationViewModel.ApplicantPhone = applicationModel.ApplicantPhone; applicationViewModel.CvPath = applicationModel.CvPath; return(Ok(applicationViewModel)); }
public async Task <IActionResult> JobOpportunities(JobApplicationViewModel model) { var rechaptchaCheck = await CheckRecaptcha(model.RechaptchaToken); if (!rechaptchaCheck.success) { return(Json(Result.Create(model, "Invalid ReCaptcha", 500))); } var mappedModel = _mapper.Map <JobApplication>(model); var result = Result.Create(mappedModel, 500); //MvcCaptcha mvcCaptcha = new MvcCaptcha("FormCaptcha"); //string userInput = HttpContext.Request.Form["CaptchaCode"]; //string validatingInstanceId = HttpContext.Request.Form[mvcCaptcha.ValidatingInstanceKey]; //if (mvcCaptcha.Validate(userInput, validatingInstanceId)) //{ // // or you can use static Validate method of MvcCaptcha class (i.e.MvcCaptcha.Validate("FormCaptcha", userInput, validatingInstanceId); ) // MvcCaptcha.ResetCaptcha("FormCaptcha"); //} //else //{ // result = Result.Create(mappedModel, "Invalid Captcha", 500); // return Json(result); //} if (ModelState.IsValid) { if (Request.Form.Files.Count != 0) { mappedModel.ResumePath = SaveFile(); } result = await _jobApplicationCrudService.CreateAsync(mappedModel); } return(Json(result)); }
public ActionResult JobApplication(int id) { if (Session["jobSeekerId"] == null) { Session.Add("message", "Currently you are not logged in. Please login to apply!"); return(RedirectToAction("JobSeekerLogin", "Login")); } var job = Repository.GetJobById(id); var employer = Repository.GetEmployerById(job.EmployerId); var jobSeekerId = (int)Session["jobSeekerId"]; var jobSeeker = Repository.GetJobSeekerById(jobSeekerId); var viewModel = new JobApplicationViewModel() { Job = job, EmployerId = employer.EmployerId, OrganizationName = employer.OrganizationName, JobSeekerId = jobSeeker.JobSeekerId, JobSeekerUsername = jobSeeker.Username }; return(View(viewModel)); }
public async Task <IActionResult> ApplyForOffer(int id, [Bind("OfferId,JobTitle,CompanyName,Location,FirstName,LastName,PhoneNumber,EmailAddress,ContactAgreement,CvUrl")] JobApplicationViewModel application) { if (ModelState.IsValid) { JobApplication jobApplication = application; jobApplication.Created = DateTime.Now; _context.Add(jobApplication); await _context.SaveChangesAsync(); var msg = new SendGridMessage(); msg.SetFrom(new EmailAddress("*****@*****.**", "Job Apply Team")); msg.AddTo(new EmailAddress(jobApplication.EmailAddress, jobApplication.FirstName + " " + jobApplication.LastName)); msg.SetSubject("Application sent, confirmation"); msg.AddContent(MimeType.Text, "Hi, your application was sent correctly"); var client = new SendGridClient(apiKey); var resposne = await client.SendEmailAsync(msg); if (User.Identity.IsAuthenticated) { return(RedirectToAction(nameof(Index))); } else { return(RedirectToAction("Index", "JobOffers")); } } else { return(View(application)); } }
public async Task <JobApplicationViewModel> AddJobApplications(JobApplicationViewModel model) { var mapped = _mapper.Map <JobApplications>(model); await _jobApplicationRepository.Add(mapped); return(model); }
public async Task <IActionResult> UpdateJobApplication(string encry_id, bool complete, bool rejected) { JobApplicationViewModel jobApplicationModel = new JobApplicationViewModel(); int id = Convert.ToInt32(_Protector.Unprotect(encry_id)); //getting the jobapplication try { jobApplicationModel = await _jobApplicationPage.getJobApplicationById(id); if (complete) { jobApplicationModel.status = status_Complete; } if (rejected) { jobApplicationModel.status = status_Rejected; return(RedirectToAction("UpdateJobApplicationPost", jobApplicationModel)); } } catch (Exception ex) { Console.WriteLine(ex.Message); } return(View(jobApplicationModel)); }
public Task <int> UpdaterJobApplication(JobApplicationViewModel jobApplicationViewModel) { var jobApplication = ReadJobApplication(jobApplicationViewModel.Result[0].Id); jobApplication.Result = Using <IMapper>().Map <IList <JobApplicationDTO> >(jobApplicationViewModel.Result); Using <AssessmentDbContext>().Update(jobApplication.Result); return(Using <AssessmentDbContext>().SaveChangesAsync()); }
/// <summary> /// for details of Application status on details click /// </summary> /// <param name="id"></param> /// <param name="conflict"></param> /// <returns></returns> public async Task <IActionResult> Details(int id, int conflict) { if (conflict != 0) { ViewData["msg"] = conflict; } JobApplicationViewModel jobApplicationModel = new JobApplicationViewModel(); try { jobApplicationModel = await _jobApplicationPage.getJobApplicationById(id); } catch (Exception ex) { Console.WriteLine(ex.Message); } //getting candidate schedules CandidateViewModel model = new CandidateViewModel(); model = await _candidatePage.getCandidateByIdWithSchedules(jobApplicationModel.candidateId); //pushing candidate schedules to custom scheudules in job applicationViewmodel for view. jobApplicationModel.Schedules = model.Schedules; //giving interviewer name list to each schedule in jobapplication try { if (jobApplicationModel.Schedules != null) { int i = 0; foreach (var schedule in jobApplicationModel.Schedules) { List <UserModel> listOfUser = getInterviewerNames(schedule.ID); jobApplicationModel.Schedules[i].InterviewerNames = listOfUser; //setting statusName using status int from ENUM jobApplicationModel.Schedules[i].statusName = Enum.GetName(typeof(StatusType), jobApplicationModel.Schedules[i].status); i++; } } } catch (Exception ex) { Console.WriteLine(ex.Message); } //getting candidate name jobApplicationModel.candidateName = getCandidateNameById(jobApplicationModel.candidateId); //getting position jobApplicationModel.position = getPositionByCandidateId(jobApplicationModel.candidateId); //for encrypted id jobApplicationModel.EncryptionId = _Protector.Protect(jobApplicationModel.ID.ToString()); return(View(jobApplicationModel)); }
public async Task <ActionResult> Create(int id) { var jobApplication = new JobApplicationViewModel() { OfferId = id }; return(View(jobApplication)); }
/// <summary> /// Displays main view for paging jobs application. /// </summary> /// <returns></returns> public async Task <IActionResult> Index() { JobApplicationViewModel jobApplicationViewModel = new JobApplicationViewModel { JobApplicationsCount = await _context.JobApplications.CountAsync() }; return(View(jobApplicationViewModel)); }
/// <summary> /// Displays main view for paging jobs application. /// </summary> /// <returns></returns> public async Task <IActionResult> Index() { JobApplicationViewModel jobApplicationViewModel = new JobApplicationViewModel { JobApplicationsCount = await _context.JobApplications.Where(s => s.User.ProviderUserId == User.FindFirstValue(ClaimTypes.NameIdentifier)).CountAsync() }; return(View(jobApplicationViewModel)); }
public IActionResult JobApplication(JobApplicationViewModel application) { if (!ModelState.IsValid) { return(View(application)); } this.emailSender.Send(application.Email, application.FirtsName, application.Position); return(RedirectToAction("Index")); }
public async Task <IActionResult> Apply(JobApplicationViewModel model) { await _jobService.AddApplicant(new JobApplicant { Email = model.Applicant.Email, Name = model.Applicant.Name, ApplicantId = Convert.ToInt32(model.Applicant.Id), JobId = model.Job.JobId }); return(RedirectToAction("ApplySuccess", new { jobId = model.Job.JobId, applicantId = model.Applicant.Id })); }
public async Task <IActionResult> UpdateNotificationPost(JobApplicationViewModel model) { try { await _jobApplicationPage.UpdateJobApplication(model); } catch (Exception ex) { Console.WriteLine(ex.Message); } return(RedirectToAction("AdminIndex", "Home", new { })); }
public IActionResult FilterJobApplications(string EmailAddress) { var model = new List <JobApplicationViewModel>(); var applications = _context.JobApplications.Where(a => a.EmailAddress.Contains(EmailAddress)).ToList(); foreach (var app in applications) { var jobOffer = _context.JobOffers.Find(app.OfferId); JobApplicationViewModel vm = app; vm.JobTitle = jobOffer.JobTitle; vm.CompanyName = jobOffer.CompanyName; vm.Location = jobOffer.Location; model.Add(vm); } return(View("Index", model)); }
public async Task <IActionResult> UpdateJobApplicationPost(JobApplicationViewModel model) { try { await _jobApplicationPage.UpdateJobApplication(model); if (model.status == status_Rejected) { return(RedirectToAction("Index")); } } catch (Exception ex) { Console.WriteLine(ex.Message); } return(RedirectToAction("SelectedJobApplications")); }
public async Task <IActionResult> Index() { var jobApplications = await _context.JobApplications.ToListAsync(); var applications = new List <JobApplicationViewModel>(); foreach (var app in jobApplications) { var jobOffer = await _context.JobOffers.FindAsync(app.OfferId); JobApplicationViewModel vm = app; vm.JobTitle = jobOffer.JobTitle; vm.CompanyName = jobOffer.CompanyName; vm.Location = jobOffer.Location; applications.Add(vm); } return(View(applications)); }
public async Task <IActionResult> JobApplication() { var user = await _userManager.GetUserAsync(User); if (user == null) { return(View()); } var previousApplications = await _context.JobApplications.Where(x => x.UserId == user.Id).ToListAsync(); var vm = new JobApplicationViewModel() { Application = new JobApplication(), PreviousApplications = previousApplications }; return(View(vm)); }
/// <summary> /// This method is used for setting notification update to database /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task <IActionResult> NotificationDetails(int id) { JobApplicationViewModel jobApplication = new JobApplicationViewModel(); try { jobApplication = await _jobApplicationPage.getJobApplicationById(id); CandidateViewModel candidateDetail = await _candidatePage.getCandidateById(jobApplication.candidateId); jobApplication.candidate = candidateDetail; } catch (Exception ex) { Console.WriteLine(ex.Message); } return(View(jobApplication)); }
public async Task <IActionResult> UpdateScheduleOfJobApplication(int JobApplicationId, int scheduleId, bool delete = false) { JobApplicationViewModel jobApplicationModel = new JobApplicationViewModel(); CandidateViewModel model = new CandidateViewModel(); //checking for deleting schedule action try { if (delete == true) { await _schedulesPage.DeleteSchedule(scheduleId); return(RedirectToAction("Details", "JobApplication", new { id = JobApplicationId })); } //for updating schedules jobApplicationModel = await _jobApplicationPage.getJobApplicationById(JobApplicationId); //getting candidate model = await _candidatePage.getCandidateByIdWithSchedules(jobApplicationModel.candidateId); } catch (Exception ex) { Console.WriteLine(ex.Message); } //finding schedule to be edited SchedulesViewModel scheduleModel = new SchedulesViewModel(); foreach (var item in model.Schedules) { if (item.ID == scheduleId) { scheduleModel = item; } } //getting dropdown of AspNetUsers from DB var allusers = (from element in _dbContext.Users select element).ToList(); ViewBag.users = allusers; return(View(scheduleModel)); }
public ActionResult adminJobApplicationEdit(int id) { //Get API authenication key by combining the server's public key with the client's private key and then hashing the result using SHA1 //string AUTHKEY = getAuthKey(CLIENTPRIVATEKEY); string url = $"jobsapplicationsapi/applicationdetails/{AUTHKEY}/{id}"; HttpResponseMessage response = client.GetAsync(url).Result; if (response.IsSuccessStatusCode) { JobApplicationViewModel applicationViewModel = response.Content.ReadAsAsync <JobApplicationViewModel>().Result; return(View(applicationViewModel)); } else { return(View("Error")); } }
/// <summary> /// SETS THE NOTIFIED FLAG OF SCHEDULE TO TRUE WHEN ADMIN CONFIRMS THE NOTIFICATION /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task <IActionResult> UpdateNotification(int id) { JobApplicationViewModel model = new JobApplicationViewModel(); try { //getting job application model = await _jobApplicationPage.getJobApplicationById(id); //setting flag model.notified = true; } catch (Exception ex) { Console.WriteLine(ex.Message); } return(RedirectToAction("UpdateNotificationPost", model)); }
public IHttpActionResult createJobApplication([FromBody] JobApplicationViewModel newApplicationViewModel, string key) { if (key != AUTHKEY) { return(StatusCode(HttpStatusCode.InternalServerError)); } //Debug.WriteLine(NewAd.Title); //Will Validate according to data annotations specified on model if (!ModelState.IsValid) { return(BadRequest(ModelState)); } JobApplicationsModel newJobApplication = new JobApplicationsModel { ApplicantFirstName = newApplicationViewModel.ApplicantFirstName, ApplicantLastName = newApplicationViewModel.ApplicantLastName, ApplicantEmail = newApplicationViewModel.ApplicantEmail, ApplicantPhone = newApplicationViewModel.ApplicantPhone, ApplicationDate = newApplicationViewModel.ApplicationDate, PostingId = newApplicationViewModel.PostingId, CvPath = newApplicationViewModel.CvPath }; try { db.JobApplications.Add(newJobApplication); db.SaveChanges(); return(Ok()); } catch { return(StatusCode(HttpStatusCode.InternalServerError)); } }
public ActionResult postAdminApplicationEdit(JobApplicationViewModel editedApplication) { if (!ModelState.IsValid) { return(View("Error")); } // Validate incoming form data to ensure that all necessary fields have been completed if (editedApplication.ApplicantFirstName == "" || editedApplication.ApplicantFirstName == null || editedApplication.ApplicantLastName == "" || editedApplication.ApplicantLastName == null || editedApplication.ApplicantEmail == "" || editedApplication.ApplicantEmail == null || editedApplication.PostingId <= 0 || Path.GetExtension(editedApplication.CvPath) != ".pdf") { return(View("IncompleteForm")); } //Get API authenication key by combining the server's public key with the client's private key and then hashing the result using SHA1 //string AUTHKEY = getAuthKey(CLIENTPRIVATEKEY); string url = $"jobsapplicationsapi/editapplication/{AUTHKEY}"; HttpContent content = new StringContent(jss.Serialize(editedApplication)); content.Headers.ContentType = new MediaTypeHeaderValue("application/json"); HttpResponseMessage response = client.PostAsync(url, content).Result; if (response.IsSuccessStatusCode) { return(View(editedApplication)); } else { return(View("Error")); } }
public async Task <IActionResult> ApplyForOffer(int?id) { if (id == null) { return(NotFound()); } var jobOffer = await _context.JobOffers.FindAsync(id); if (jobOffer == null) { return(NotFound()); } JobApplicationViewModel model = new JobApplicationViewModel() { OfferId = id.Value, JobTitle = jobOffer.JobTitle, CompanyName = jobOffer.CompanyName, Location = jobOffer.Location }; return(View(model)); }
public async Task <IActionResult> Create(JobApplicationViewModel model) { //ToDo: Accept only pdf if (!ModelState.IsValid) { return(View(model)); } var userId = User.FindFirst(ClaimTypes.NameIdentifier).Value; JobApplication jobApplicationDb = _context.JobApplications.FirstOrDefault(application => application.UserId == userId && application.OfferId == model.OfferId); if (jobApplicationDb != null) { _context.JobApplications.Remove(jobApplicationDb); } string cvFileName = await SaveCVToStorage(model); JobApplication jobApplication = new JobApplication() { FirstName = model.FirstName, LastName = model.LastName, EmailAddress = model.EmailAddress, PhoneNumber = model.PhoneNumber, ContactAgreement = model.ContactAgreement, OfferId = model.OfferId, CvUrl = cvFileName, UserId = userId }; _context.JobApplications.Add(jobApplication); await _context.SaveChangesAsync(); return(RedirectToAction("Details", "JobOffer", new { id = model.OfferId })); }