Exemplo n.º 1
0
        public ActionResult ViewMessage(int messageID)
        {
            if (!_messageServices.CanViewMessage(_currentUser.UserID, messageID))
            {
                return(RedirectToAction("Inbox"));
            }

            SetBreadCrumb("View Message");
            Message message = _messageServices.GetMessage(messageID);

            if (message.ToUserID == _currentUser.UserID && !message.IsRead)
            {
                _messageServices.MarkAsRead(messageID);
            }

            var model = new ViewMessageViewModel()
            {
                Message              = message,
                ParsedText           = _parseServices.ParseBBCodeText(message.Text),
                SendMessageViewModel = new SendMessageViewModel()
                {
                    Username = message.FromUser.Username, Subject = "RE:" + message.Subject
                }
            };

            return(View(model));
        }