public IActionResult Index() { ViewBag.Active = 0; ViewBag.TotalUser = _userService.GetAll().Count(); ViewBag.TotalVideo = _videoService.GetAll().Count(); ViewBag.TotalReport = _reportService.GetAll().Count(); ViewBag.TotalCategory = _categoryService.GetAll().Result.Count; var listRankedVideo = _videoService.GetAll().OrderByDescending(x => x.ViewCount).Take(10).ToList(); return(View(listRankedVideo)); }
public IActionResult AnalysisUser(int id) { ViewBag.IdUser = id; ViewBag.UserFollow = _followChanel.GetAll().Where(x => x.ToUserId == id).Count(); ViewBag.CountViewChannel = _videoService.GetAll().Where(x => x.AppUserId == id).Sum(x => x.ViewCount); ViewBag.CountVideo = _videoService.GetAll().Where(x => x.AppUserId == id).Count(); ViewBag.CountReport = (from report in _reportService.GetAll() join video in _videoService.GetAll().Where(x => x.AppUserId == id) on report.VideoId equals video.Id select report).Count(); ViewBag.CoutCategory = _videoService.GetAll().Where(x => x.AppUserId == id).GroupBy(x => x.CategorysId).Count(); var listRankedVideo = _videoService.GetAll().Where(x => x.AppUserId == id).OrderByDescending(x => x.ViewCount).Take(10).ToList(); return(View(listRankedVideo)); }