public IActionResult Index() { int SumQuestions = 0; //int SumAnswers = 0; var Categories = _categoryImplementation.GetAll(); foreach (var category in Categories) { SumQuestions += category.Questions.Count(); } //foreach (var category in Categories) //{ // var Questions = category.Questions; // foreach (var question in Questions) // { // SumAnswers += question.Answers.Count(); // } //} var model = new PanelIndexModel { NumberForums = _categoryImplementation.GetAll().Count(), NumberQuestions = SumQuestions, NumberMember = _applicationUserImplementation.GetAll().Count(), NumberUser = _context.Visits.Count(), NumberReplies = _questionImplementation.GetAllAnswers().Count(), //NumberLike = _categoryImplementation.GetAll().Count(), }; return(View(model)); }