Ejemplo n.º 1
0
        public ActionResult Send(Message message)
        {
            var messageId = message.Id;

            if (string.IsNullOrEmpty(message.MessageCode))
            {
                messageId = _iMessageServices.Send(new MessageSendUser()
                {
                    MessageCode  = message.MessageCode,
                    SendUserId   = User.Model.Id,
                    AcceptUserId = message.AcceptUserId,
                    Title        = message.Title,
                    Content      = message.Content
                });
            }
            else
            {
                _iMessageServices.Reply(new MessageAcceptUser()
                {
                    MessageCode  = message.MessageCode,
                    SendUserId   = User.Model.Id,
                    AcceptUserId = message.AcceptUserId,
                    Title        = message.Title,
                    Content      = message.Content,
                    IsRead       = false
                });
            }
            MessageCilent.Invoke("Letter", User.Model.Id, messageId);
            if (message.MessageCode.IsNullOrEmpty())
            {
                SetMessage($"发送成功");
                return(Redirect($"~/Message/Index"));
            }
            else
            {
                SetMessage($"回复成功");
                return(Redirect($"~/Message/letter?id={messageId}"));
            }
        }