Exemple #1
0
        public JobsViewModel GetJobsViewModel(int page)
        {
            var jobs       = jobsRepository.GetAvailableJobs();
            var totalJobs  = jobs.Count();
            var jobsInPage = configuration.GetValue <int>("JoinsInPage");

            return(new JobsViewModel()
            {
                CurrentPage = page,
                TotalPages = totalJobs / jobsInPage + ((totalJobs % jobsInPage == 0) ? 0 : 1),
                Jobs = jobs.Skip((page - 1) * jobsInPage).Take(jobsInPage).ToList()
            });
        }