コード例 #1
0
 public IActionResult Index()
 {
     return(View(new ExperienceListViewModel
     {
         Experiences = _experienceService.GetList()
     }));
 }
コード例 #2
0
 public IViewComponentResult Invoke()
 {
     return(View(new ExperienceListViewModel
     {
         Experiences = _experienceService.GetList().OrderByDescending(p => p.Id).ToList()
     }));
 }
コード例 #3
0
        public IActionResult GetSectorExperienceYearGender()
        {
            GetSectorExperienceYearGenderDto data = new GetSectorExperienceYearGenderDto();
            var sector = _sectorService.GetList();

            if (!sector.Success)
            {
                return(Ok(new ErrorDataResult <GetSectorExperienceYearGenderDto>()));
            }
            var experience = _experienceService.GetList();

            if (!experience.Success)
            {
                return(Ok(new ErrorDataResult <GetSectorExperienceYearGenderDto>()));
            }
            var gender = _genderService.GetList();

            if (!gender.Success)
            {
                return(Ok(new ErrorDataResult <GetSectorExperienceYearGenderDto>()));
            }
            try
            {
                data.Sectors     = _mapper.Map <List <SectorDto> >(sector.Data);
                data.Experiences = _mapper.Map <List <ExperienceDto> >(experience.Data);
                data.Genders     = _mapper.Map <List <GenderDto> >(gender.Data);
            }
            catch (System.Exception)
            {
                //todo:log ex
                return(Ok(new ErrorDataResult <GetSectorExperienceYearGenderDto>()));
            }
            return(Ok(new SuccessDataResult <GetSectorExperienceYearGenderDto>(data)));
        }