public async Task <ActionResult> Index([FromServices] IWebHostEnvironment hostEnvironment) { var list = await LinksService.GetQueryFromCacheAsync <bool, LinksDto>(l => l.Status == Status.Available, l => l.Recommend, false); ViewBag.Html = await new FileInfo(Path.Combine(hostEnvironment.WebRootPath, "template", "links.html")).ShareReadWrite().ReadAllTextAsync(Encoding.UTF8); ViewBag.Ads = AdsService.GetByWeightedPrice(AdvertiseType.InPage, Request.Location()); return(CurrentUser.IsAdmin ? View("Index_Admin", list) : View(list)); }
public async Task <ActionResult> Index() { var list = await LinksService.GetQueryFromCacheAsync <bool, LinksDto>(l => l.Status == Status.Available, l => l.Recommend, false); ViewBag.Html = await System.IO.File.ReadAllTextAsync(Path.Combine(HostEnvironment.WebRootPath, "template", "links.html")); return(CurrentUser.IsAdmin ? View("Index_Admin", list) : View(list)); }