コード例 #1
0
        public async Task <ActionResult> Notifications()
        {
            ViewBag.PmView           = "notifications";
            ViewBag.selectedView     = "notifications";
            ViewBag.Title            = "All Unread Notifications";
            ViewBag.SelectedSubverse = "";
            var q     = new QueryAllMessageCounts(Domain.Models.MessageTypeFlag.All, Domain.Models.MessageState.Unread);
            var model = await q.ExecuteAsync();

            return(View(model));
        }
コード例 #2
0
        public async Task <ActionResult> Notifications()
        {
            //ViewBag.PmView = "notifications";
            //ViewBag.selectedView = "notifications";
            //ViewBag.Title = "All Unread Notifications";
            //ViewBag.SelectedSubverse = "";
            var q     = new QueryAllMessageCounts(User, MessageTypeFlag.All, MessageState.Unread).SetUserContext(User);
            var model = await q.ExecuteAsync();

            SetMenuNavigationModel("Notifications", MenuType.UserMessages);

            return(View(model));
        }
コード例 #3
0
        public async Task <ActionResult> Index(int?page = null)
        {
            var unread = new QueryAllMessageCounts(User, MessageTypeFlag.All, MessageState.Unread).SetUserContext(User);
            var counts = await unread.ExecuteAsync();

            //var unread = new QueryMessageCounts(User, MessageTypeFlag.All, MessageState.Unread).SetUserContext(User);
            //var counts = await unread.ExecuteAsync();


            if (counts.Any(x => x.UserDefinition.Type == IdentityType.Subverse && x.Total > 0))
            {
                //is admin, send them to notfication page becasue they have smail
                SetMenuNavigationModel("Notifications", MenuType.UserMessages);
                return(View("Notifications", counts));
            }
            else
            {
                var userCounts = counts.FirstOrDefault(x => x.UserDefinition.Type == IdentityType.User);

                if (userCounts.Total > 0)
                {
                    if (userCounts.Counts.Any(x => x.Type == MessageType.Private))
                    {
                        return(await Private(page));
                    }
                    else if (userCounts.Counts.Any(x => x.Type == MessageType.SubmissionMention))
                    {
                        return(await Mentions(ContentType.Submission, page));
                    }
                    else if (userCounts.Counts.Any(x => x.Type == MessageType.CommentMention))
                    {
                        return(await Mentions(ContentType.Comment, page));
                    }
                    else if (userCounts.Counts.Any(x => x.Type == MessageType.SubmissionReply))
                    {
                        return(await Replies(ContentType.Submission, page));
                    }
                    else if (userCounts.Counts.Any(x => x.Type == MessageType.CommentReply))
                    {
                        return(await Replies(ContentType.Comment, page));
                    }
                }
                return(await Private(page));
            }
        }