Пример #1
0
        public ActionResult StatCounter()
        {
            var ds = Sitecore.Context.Database.GetItem(RenderingContext.CurrentOrNull.Rendering.DataSource);

            if (ds == null)
            {
                return(View());
            }

            var viewModel = new StatCounterViewModel()
            {
                StatBlocks = new List <StatBlock>()
            };

            viewModel.StatBlocks.Add(new StatBlock()
            {
                Label = ds["Users Text"],
                Value = _teamsRepository.GetTeamMemberCount()
            });
            viewModel.StatBlocks.Add(new StatBlock()
            {
                Label = ds["Countries Text"],
                Value = 39
            });
            viewModel.StatBlocks.Add(new StatBlock()
            {
                Label = ds["Teams Text"],
                Value = _teamsRepository.GetTeamsCount()
            });
            return(View(viewModel));
        }