public async Task <ActionResult> Create(JobOfferCreateViewModel model)
        {
            var currentEmployer = await EmployerFacade.GetEmployerByEmail(User.Identity.Name);

            if (!CheckQuestionChange(model) && ModelState.IsValid)
            {
                model.JobOfferCreateDto.EmployerId = currentEmployer.Id;
                await JobOfferFacade.CreateJobOffer(model.JobOfferCreateDto);

                return(RedirectToAction("OffersOfCurrentEmployer"));
            }

            model.AllSkills = await SkillSelectListHelper.Get();

            model.Employer = currentEmployer;


            return(View(model));
        }
Esempio n. 2
0
        private static async Task TestCreateOffer(Mapper mapper)
        {
            JobOfferFacade jobOfferFacade = new JobOfferFacade(Provider, mapper,
                                                               new JobOfferService(mapper, new JobOfferRepository(Provider),
                                                                                   new JobOfferQueryObject(mapper, new EntityFrameworkQuery <JobOffer>(Provider)), new SkillRepository(Provider)),
                                                               new SkillService(mapper, new SkillRepository(Provider),
                                                                                new SkillQueryObject(mapper, new EntityFrameworkQuery <SkillTag>(Provider))),
                                                               new JobOfferRecommendationService(),
                                                               new UserService(mapper, new UserRepository(Provider),
                                                                               new UserQueryObject(mapper, new EntityFrameworkQuery <User>(Provider)),
                                                                               new SkillRepository(Provider)));

            await jobOfferFacade.CreateJobOffer(new JobOfferCreateDto
            {
                Description = "desc1",
                EmployerId  = 1,
                Location    = "loc1",
                Name        = "name1",
                Questions   = new[] { "q1", "q2", "q3" },
                SkillNames  = new[] { "Java", "Php" },
            });

            var results = await jobOfferFacade.GetAllOffersOfEmployer(1);

            foreach (var resultsItem in results)
            {
                Console.WriteLine(resultsItem.Name);
            }

            var results1 = await jobOfferFacade.GetOffersBySkill(1);

            foreach (var resultsItem in results1)
            {
                Console.WriteLine(resultsItem.Name);
            }
        }