示例#1
0
        public IViewComponentResult Invoke()
        {
            var container = new UserNavigationContainer();

            container.User = _userRetrievalShim.GetUser(HttpContext);
            if (container.User != null)
            {
                var count = _privateMessageService.GetUnreadCount(container.User);
                if (count > 0)
                {
                    container.PMCount = String.Format("<span class=\"badge\">{0}</span>", count);
                }
            }
            return(View(container));
        }
示例#2
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var container = new UserNavigationContainer();

            container.User = _userRetrievalShim.GetUser();
            if (container.User != null)
            {
                var count = await _privateMessageService.GetUnreadCount(container.User);

                if (count > 0)
                {
                    container.PMCount = $"<span class=\"badge\">{count}</span>";
                }
            }
            return(View(container));
        }