Пример #1
0
        public RedirectToActionResult Create(Vacancy employee)
        {
            Vacancy newEmployee = new Vacancy
            {
                VacancyId   = employee.VacancyId,
                Description = employee.Description,
                Date        = employee.Date,
                Time        = employee.Time,
            };

            _empRepo.Add(newEmployee);
            return(RedirectToAction("AllDetails"));
        }
Пример #2
0
        public IActionResult AddVacancy(VacancyViewModel model)
        {
            if (ModelState.IsValid)
            {
                // Copy the information to the vacancy object to be stored in the database.
                Vacancy vacancy = new Vacancy
                {
                    JobTitle    = model.JobTitle,
                    JobType     = model.JobType,
                    JobPeriod   = model.JobPeriod,
                    Salary      = model.Salary,
                    PayInterval = model.PayInterval,
                    Description = model.Description
                };

                vacancyRepository.Add(vacancy);

                return(RedirectToAction("Vacancies", "Home"));
            }

            return(View(model));
        }
Пример #3
0
        public async Task <CreateVacancyResult> Handle(CreateVacancy command)
        {
            var vacancyId = Guid.NewGuid();
            var vacancy   = command.Vacancy;

            var entity = new VacancyEntity
            {
                Id   = vacancyId,
                Form = new FormEntity
                {
                    Questions = new List <QuestionEntity>()
                }
            };

            entity.Update(vacancy);
            _vacancyRepository.Add(entity);

            await _unitOfWork.SaveChangesAsync();

            return(new CreateVacancyResult {
                VacancyId = vacancyId
            });
        }
 public Vacancy Add(Vacancy vacancy)
 {
     return(_vacancyRepository.Add(vacancy));
 }