Esempio n. 1
0
        public async Task <IActionResult> GetJobsInDemandByAllCountries()
        {
            var countries = await _repository.GetAllCountries();

            if (countries == null)
            {
                return(NotFound());
            }

            var jobsInDemands = await _repository.GetAllJobInDemands();

            if (jobsInDemands == null)
            {
                return(NotFound());
            }

            var jobsInDemandVM = new List <JobsInDemandVM>();

            foreach (var c in countries)
            {
                jobsInDemandVM.Add(new JobsInDemandVM
                {
                    CountryKR = c.NameKR,
                    Details   = GetDetails(jobsInDemands
                                           .Where(x => x.CountryId == c.CountryId)
                                           .OrderBy(x => x.TitleKR)
                                           .ToList())
                });
            }

            return(new OkObjectResult(jobsInDemandVM));
        }