public ActionResult Index(DateTime?startDate, DateTime?endDate) { var folderList = folderRepository.GetAllFoldersByDate(startDate, endDate); List <Document> docList = new List <Document>(); foreach (var fold in folderList) { if (fold is Document) { docList.Add((Document)fold); } } var reportModel = new ReportModel { AllDocuments = docList.Count, AllFilesAdded = folderList.Count, AllFolders = folderList.Count - docList.Count }; return(View(reportModel)); }