Example #1
0
        public ActionResult Index()
        {
            var paths      = new List <string>();
            var bannerPath = Server.MapPath("/Images/Banners");


            var imgs = BannerService.GetActiveBanners();

            if (imgs != null && imgs.Any())
            {
                paths.AddRange(imgs.Select(banner => banner.FileName));
            }
            var listcons = new List <ContractorIndexPageModel>();
            var cats     = CategoryService.GetAllCategories();

            if (cats != null && cats.Any())
            {
                cats = cats.OrderByDescending(ca => ca.ContractorCount).ToList().ToList();
                listcons.AddRange(cats.Select(obj => new ContractorIndexPageModel
                {
                    CatName = obj.Name, CatCount = obj.ContractorCount, CategoryId = obj.Id, BgURL = obj.Image, IconURL = obj.Icon
                }));
            }
            var feed = AdminService.GetApprovedFeedbacks();

            var jobs = JobService.GetReadyJobs(null).Take(9).ToList();

            return(View(new HomePageWraper
            {
                BannersList = paths,
                ContractorCats = listcons,
                Feedback = feed,
                Jobs = jobs
            }));
        }