//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)); }