public ActionResult getMostCommented() { var games = artSer.getMostCommented().ToArray(); var TotalGames = artSer.GetMany().ToArray(); var totalFund = artSer.GetMany().ToArray(); var comm = commSer.getDateOfComm().ToArray(); List <gameViewModels> gVM = new List <gameViewModels>(); foreach (var item in games) { gameViewModels gm = new gameViewModels() { idArticle = item.idArticle, DTYPE = item.DTYPE, name = item.name, description = item.description, link_img = item.link_img, date = item.date, commentts = item.commentts, }; gVM.Add(gm); } CommentViewModels cm = new CommentViewModels(); ViewBag.gmCount = games.Count(); ViewBag.TotalCount = TotalGames.Count(); ViewBag.notcommented = TotalGames.Count() - games.Count(); ViewBag.usersComm = users.getUsersComments().Count(); ViewBag.totalUsers = users.GetMany().Count(); ViewBag.NonActiveUsers = users.GetMany().Count() - users.getUsersComments().Count(); var comms1 = commSer.GetCommentsByMonth(1).ToArray(); var comms2 = commSer.GetCommentsByMonth(2).ToArray(); var comms3 = commSer.GetCommentsByMonth(3).ToArray(); var comms4 = commSer.GetCommentsByMonth(4).ToArray(); var comms5 = commSer.GetCommentsByMonth(5).ToArray(); var comms6 = commSer.GetCommentsByMonth(6).ToArray(); var comms7 = commSer.GetCommentsByMonth(7).ToArray(); var comms8 = commSer.GetCommentsByMonth(8).ToArray(); var comms9 = commSer.GetCommentsByMonth(9).ToArray(); var comms10 = commSer.GetCommentsByMonth(10).ToArray(); var comms11 = commSer.GetCommentsByMonth(11).ToArray(); var comms12 = commSer.GetCommentsByMonth(12).ToArray(); ViewBag.nbComm1 = comms1.Count(); ViewBag.nbComm2 = comms2.Count(); ViewBag.nbComm3 = comms3.Count(); ViewBag.nbComm4 = comms4.Count(); ViewBag.nbComm5 = comms5.Count(); ViewBag.nbComm6 = comms6.Count(); ViewBag.nbComm7 = comms7.Count(); ViewBag.nbComm8 = comms8.Count(); ViewBag.nbComm9 = comms9.Count(); ViewBag.nbComm10 = comms10.Count(); ViewBag.nbComm11 = comms11.Count(); ViewBag.nbComm12 = comms12.Count(); return(View(gVM)); }