private static async Task TestCreateApplicationRegistered(Mapper mapper) { JobApplicationFacade jobApplicationFacade = new JobApplicationFacade(Provider, new JobApplicationService(mapper, new JobApplicationRepository(Provider), new JobApplicationQueryObject(mapper, new EntityFrameworkQuery <JobApplication>(Provider)))); List <QuestionAnswerDto> questionAnswers = new List <QuestionAnswerDto>(); questionAnswers.Add(new QuestionAnswerDto { QuestionId = 1, Text = "aaaaa" }); await jobApplicationFacade.CreateApplication(new JobApplicationDto { ApplicantId = 1, JobOfferId = 1, QuestionAnswers = questionAnswers }); var results = await jobApplicationFacade.GetAllApplications(); foreach (var resultsItem in results) { Console.WriteLine(resultsItem.JobApplicationStatus); } }
private static async Task TestCreateApplicationUnRegistered(Mapper mapper) { JobApplicationFacade jobApplicationFacade = new JobApplicationFacade(Provider, new JobApplicationService(mapper, new JobApplicationRepository(Provider), new JobApplicationQueryObject(mapper, new EntityFrameworkQuery <JobApplication>(Provider)))); List <QuestionAnswerDto> questionAnswers = new List <QuestionAnswerDto>(); questionAnswers.Add(new QuestionAnswerDto { QuestionId = 1, Text = "aaaaa" }); await jobApplicationFacade.CreateApplication(new JobApplicationCreateDto() { Applicant = new ApplicantDto() { Education = "basic", Email = "*****@*****.**", FirstName = "Dilino", LastName = "Master", PhoneNumber = "+444234956" }, JobOfferId = 1, QuestionAnswers = questionAnswers }); var results = await jobApplicationFacade.GetAllApplications(); foreach (var resultsItem in results) { Console.WriteLine(resultsItem.JobApplicationStatus); } }
public async Task <ActionResult> Create(JobApplicationCreateDto application) { if (ModelState.IsValid) { await JobApplicationFacade.CreateApplication(application); return(RedirectToAction("Details", "JobOffer", new { id = application.JobOfferId })); } var offer = await JobOfferFacade.GetOffer(application.JobOfferId); application.JobOffer = offer; application.JobOfferId = offer.Id; application.Applicant = User.Identity.Name.IsNullOrEmpty() ? new ApplicantDto() : await UserFacade.GetUserByEmail(User.Identity.Name); return(View(application)); }