Beispiel #1
0
        // GET: Admin/Vacancy/Edit
        public ActionResult Edit(int id)
        {
            var entity    = _vacancyService.GetById(id);
            var viewModel = Mapper.Map <Vacancy, VacancyViewModel>(entity);

            viewModel.TechnologiesSelectList = Mapper.Map <List <Technology>, List <SelectListItem> >(_technologyService.GetAll());
            viewModel.TechnologiesSelectList.ForEach(item =>
            {
                item.Selected = viewModel.TechnologiesIds.Contains(int.Parse(item.Value));
            });

            AddLocales(viewModel.Locales, (locale, languageId) =>
            {
                locale.Title            = entity.GetLocalized(x => x.Title, languageId);
                locale.ShortDescription = entity.GetLocalized(x => x.ShortDescription, languageId);
                locale.Bonuses          = entity.GetLocalized(x => x.Bonuses, languageId);
                locale.Requirments      = entity.GetLocalized(x => x.Requirments, languageId);
                locale.Responsibilities = entity.GetLocalized(x => x.Responsibilities, languageId);
                locale.WeOffer          = entity.GetLocalized(x => x.WeOffer, languageId);
            });

            return(View(viewModel));
        }
Beispiel #2
0
        public ActionResult <Vacancy> GetById([FromRoute] int id)
        {
            try
            {
                var vacancy = _VacancyService.GetById(id);

                if (vacancy == null)
                {
                    return(NotFound("Vacancy not found!"));
                }

                return(Ok(vacancy));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
 public IActionResult Get(Guid id)
 {
     return(Ok(_service.GetById(id)));
 }
        public ActionResult Career(int id)
        {
            var viewModel = Mapper.Map <Vacancy, VacancyViewModel>(_vacancyService.GetById(id));

            return(View(viewModel));
        }