Exemplo n.º 1
0
        //Reuse for all the search for JobAdverts for all Types of users
        private IList <ViewJobAdvertViewModel> ProcessAdvert(IList <JobAdvert> jobAdvertList)
        {
            var adverts = new List <ViewJobAdvertViewModel>();

            if (jobAdvertList == null)
            {
                return(null);
            }

            foreach (var item in jobAdvertList)
            {
                adverts.Add(
                    new ViewJobAdvertViewModel
                {
                    Caption         = item.Caption,
                    Introduction    = item.Introduction,
                    City            = _cityService.Get(item.CityId).Name,
                    CompanyName     = _companyService.Get(item.CompanyId).CompanyName,
                    JobType         = _jobTypeService.Get(item.JobTypeId).Description,
                    ExperienceLevel = _experienceLevelService.Get(item.ExperienceLevelId).Description,
                    Category        = _jobCategoryService.Get(item.JobCategoryId).Name,
                    CreatedDate     = (DateTime)item.CreatedDate,
                    JobAdvertId     = item.Id
                });
            }

            return(adverts);
        }
        public async Task <IActionResult> Get()
        {
            var categoryDTOs = await jobCategoryService.Get();

            var categoryModels = mapper.Map <IEnumerable <JobCategoryDTO>, IEnumerable <JobCategoryModel> >(categoryDTOs);

            return(Ok(categoryModels));
        }