public async Task PostJobPostingAsync(JobPostingInputModel input) { var jobPosting = new JobPosting { Title = input.JobTitle, Address = input.Location, Requirements = input.Requirements, Skills = input.Skills, Responsibilities = input.Responsibilities, Description = input.Description, Benefits = input.Benefits, Type = input.VacancyType, JobPostingCategoryId = input.JobPostingCategoryId, Instructions = input.Instructions, CompanyInfoId = input.CompanyInfoId, MinSalary = input.MinSalary, MaxSalary = input.MaxSalary, CityId = input.CityId, }; //// TODO: Insert Logo in JobPosting await this.jobRepository.AddAsync(jobPosting); await this.jobRepository.SaveChangesAsync(); }
public async Task PostCompanyInfoAsyncTest() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()); var repository = new EfDeletableEntityRepository <JobPosting>(new ApplicationDbContext(options.Options)); foreach (var item in this.GetJobPostingData()) { await repository.AddAsync(item); await repository.SaveChangesAsync(); } var service = new JobPostingsService(repository); var inputModel = new JobPostingInputModel { JobTitle = "Game Developer", Description = "cfbdsuicbsioachnishc", Location = "ncscnskojcos", Requirements = "bciusdbciosbchishncs", Skills = "bhisudbc isubc is", Responsibilities = "cbsucbn sicsinhcsnhucv dxicjnis", Benefits = "bcsuigvfdgvdvdvdfcdz", Category = "Game", JobPostingCategoryId = "1", CompanyInfoId = "11", VacancyType = "Full time", CityId = "111", Instructions = "nhcidoshncsdhncsd", MaxSalary = 2500, MinSalary = 1000, }; await service.PostJobPostingAsync(inputModel); var candidatesCount = repository.All().ToList().Count; Assert.Equal(2, candidatesCount); }
public async Task <IActionResult> JobPostings(JobPostingInputModel input) { var userId = this.userManager.GetUserId(this.User); var userType = this.accountTypeService.GetAccountTypeController(userId); if (userType == "Candidate") { this.Redirect("/"); } if (input.MinSalary != 0 && input.MaxSalary != 0 && input.MinSalary >= input.MaxSalary) { return(this.RedirectToAction("JobPostings")); } if (!this.ModelState.IsValid) { return(this.View()); } var categoryId = this.categoriesService.GetCategoryId(input.Category); input.JobPostingCategoryId = categoryId; var companyInfoId = this.companyInfoService.GetCompanyInfoId(userId); input.CompanyInfoId = companyInfoId; var cityId = this.citiesService.GetCityId(input.CityName); input.CityId = cityId; await this.jobPostingService.PostJobPostingAsync(input); return(this.Redirect("/")); }