Example #1
0
        public ActionResult Sent(int?pageNumber, int?pageSize)
        {
            ViewBag.ManageNavigationKey = "sent";

            if (pageNumber == null || pageNumber < 1)
            {
                pageNumber = 1;
            }
            if (pageSize == null)
            {
                pageSize = 25;
            }
            if (pageSize > 100)
            {
                pageSize = 100;
            }
            if (pageSize < 1)
            {
                pageSize = 1;
            }

            var skip = (pageNumber - 1) * pageSize;
            var take = pageSize;

            var messages = _messageDao.GetSentMessagesForUser(_userContext.CurrentUser.Id, skip, take);

            var model = new InboxViewModel();

            model.InboxType   = InboxType.Sent;
            model.IsModerator = _moderationDao.GetSubsModeratoredByUser(_userContext.CurrentUser.Id).Count > 0;
            model.Messages    = new PagedList <MessageWrapped>(_messageWrapper.Wrap(messages, _userContext.CurrentUser), pageNumber.Value, pageSize.Value, messages.HasMore);

            return(View(model));
        }