public async Task <ActionResult> JobOfferList(JobOfferListModel model) { if (!model.ApplyFavorite) { var applicant = await ApplicantFacade.GetApplicantAccordingToUsernameAsync(User.Identity.Name); if (model.ApplyKeywords) { model.Filter.KeywordNumbers = applicant.KeywordNumbers; } var result = await JobOfferFacade.GetJobOffersAsync(model.Filter); model.JobOffers = new List <JobOfferDto>(result.Items); } else { var applicant = await ApplicantFacade.GetApplicantAccordingToUsernameAsync(User.Identity.Name); var result = await JobOfferFacade.GetFavoriteJobOffersAsync(applicant.Id); model = new JobOfferListModel { JobOffers = new List <JobOfferDto>(result.Items), ApplyFavorite = true }; } return(View(model)); }
public async Task <ActionResult> FavoriteJobDelete(Guid jobOfferId) { var applicant = await ApplicantFacade.GetApplicantAccordingToUsernameAsync(User.Identity.Name); Guid favoriteJobId = await JobOfferFacade.GetFavoriteByApplicantAndOffer(applicant.Id, jobOfferId); await JobOfferFacade.DeleteFavoriteJobOfferAsync(favoriteJobId); return(RedirectToAction("JobOfferList", "Applicant")); }
public async Task <ActionResult> FavoriteJobCreate(Guid jobOfferId) { var applicant = await ApplicantFacade.GetApplicantAccordingToUsernameAsync(User.Identity.Name); var favoriteJob = new FavoriteJobDto { JobOfferId = jobOfferId, ApplicantId = applicant.Id }; await JobOfferFacade.CreateFavoriteJobAsync(favoriteJob); return(RedirectToAction("JobOfferList", "Applicant")); }
public async Task <ActionResult> JobOfferDetail(Guid id) { var applicant = await ApplicantFacade.GetApplicantAccordingToUsernameAsync(User.Identity.Name); var model = new JobOfferDetailModel { JobOffer = await JobOfferFacade.GetJobOfferAsync(id), AlreadyApplied = await ApplicationFacade.CheckIfApplied(applicant.Id, id), AlreadyFavorite = await JobOfferFacade.CheckIfFavorite(applicant.Id, id) }; return(View(model)); }
public async Task <ActionResult> ChangeApplicantInformation() { var applicant = await ApplicantFacade.GetApplicantAccordingToUsernameAsync(User.Identity.Name); var model = new ApplicantEditModel { Applicant = applicant, Keywords = new List <bool>() }; for (int i = 0; i < Enum.GetNames(typeof(Keyword)).Length; i++) { model.Keywords.Add(applicant.KeywordNumbers.Contains(i)); } return(View(model)); }
public async Task <ActionResult> ApplicationList() { var applicant = await ApplicantFacade.GetApplicantAccordingToUsernameAsync(User.Identity.Name); var filter = new ApplicationFilterDto { ApplicantId = applicant.Id }; var result = await ApplicationFacade.GetApplicationsAsync(filter); var model = new ApplicationListModel { Filter = filter, Applications = new List <ApplicationDto>(result.Items), ApplicantId = applicant.Id }; return(View(model)); }
public async Task <ActionResult> ApplicationCreate(ApplicationDto model) { var applicant = await ApplicantFacade.GetApplicantAccordingToUsernameAsync(User.Identity.Name); model.ApplicantId = applicant.Id; model.State = ApplicationState.Undecided; await ApplicationFacade.CreateApplicationAsync(model); Guid favoriteJobId = await JobOfferFacade.GetFavoriteByApplicantAndOffer(applicant.Id, model.JobOfferId); if (favoriteJobId != Guid.Empty) { await JobOfferFacade.DeleteFavoriteJobOfferAsync(favoriteJobId); } return(RedirectToAction("ApplicationList", "Applicant")); }
public async Task <ActionResult> Index() { var applicant = await ApplicantFacade.GetApplicantAccordingToUsernameAsync(User.Identity.Name); return(View(applicant)); }