public async Task <IActionResult> Index(int adStatus = 2, int page = 1)
        {
            int pageSize = 5;
            ModerationAdIndexViewModel model = new ModerationAdIndexViewModel
            {
                AdList           = new List <AdDTO>(),
                SelectedAdStatus = adStatus
            };

            if (adStatus == (int)AdStatuses.Activated)
            {
                var getActiveAds = await _adService.GetActiveAds();

                model.AdList = getActiveAds.Property.ToList();
            }
            else if (adStatus == (int)AdStatuses.InProgress)
            {
                var getInProgress = await _adService.GetInProgressAds();

                model.AdList = getInProgress.Property.ToList();
            }
            else if (adStatus == (int)AdStatuses.Deactivated)
            {
                var getDeactivatedAds = await _adService.GetDeactivatedAds();

                model.AdList = getDeactivatedAds.Property.ToList();
            }

            int count = model.AdList.Count();

            model.PageViewModel = new PageViewModel(count, page, pageSize);
            model.AdList        = model.AdList.Skip((page - 1) * pageSize).Take(pageSize).ToList();

            return(View(model));
        }
        public async Task <IActionResult> Index(string titleFilter, string cityFilter, string productState, AdIndexViewModel model, int page = 1)
        {
            int pageSize = 5;

            var result = await _adService.GetActiveAds();

            if (!result.Succedeed)
            {
                return(View(model));
            }

            var topAds = await _adService.GetActiveRandomTopAds();

            List <AdDTO> adQueryResult = result.Property;

            adQueryResult = await _adFilter.FilteringData(titleFilter, productState, adQueryResult, model);

            model = await _adFilter.PrepearingFilter(adQueryResult, model);

            if (topAds.Property.Count() > 0)
            {
                model.TopAds = topAds.Property.ToList();
            }

            int           count         = model.SimpleAds.Count();
            PageViewModel pageViewModel = new PageViewModel(count, page, pageSize);

            model.PageViewModel = pageViewModel;
            model.SimpleAds     = model.SimpleAds.Skip((page - 1) * pageSize).Take(pageSize).ToList();

            return(View(model));
        }
        //private readonly IAdService _adService;

        //public HomeController(IAdService adService)
        //{
        //    _adService = adService;
        //}

        public async Task <IActionResult> Index()
        {
            HomeIndexViewModel model = new HomeIndexViewModel()
            {
                LatestAds = new List <AdDTO>(),
                VipAds    = new List <AdDTO>()
            };

            var latestAdsResult = await _adService.GetActiveAds();

            var vipAds = await _adService.GetActiveRandomVIPAds();

            if (latestAdsResult.Property != null)
            {
                model.LatestAds = latestAdsResult.Property.OrderByDescending(x => x.AdId).Take(12).ToList();
            }

            if (vipAds.Property != null)
            {
                model.VipAds = vipAds.Property.ToList();
            }

            return(View(model));
        }