public ActionResult _CustomCreateMessage(string spaceKey, MessageEditModel model)
 {
     EmotionService emotionService = DIContainer.Resolve<EmotionService>();
     model.Body = emotionService.EmoticonTransforms(model.Body);
     User currentSpaceUser = (User)UserContext.CurrentUser;
     if (currentSpaceUser == null)
         return HttpNotFound();
     IEnumerable<long> toUserIds = Request.Form.Gets<long>("ToUserIds");
     IEnumerable<User> toUsers = userService.GetFullUsers(toUserIds);
     Message message = null;
     foreach (var toUser in toUsers)
     {
         if (DIContainer.Resolve<Authorizer>().Message(toUser.UserId))
         {
             message = model.AsMessage();
             message.MessageType = MessageType.Common;
             message.Receiver = toUser.DisplayName;
             message.ReceiverUserId = toUser.UserId;
             message.SenderUserId = (long)BuildinMessageUserId.CustomerService;
             message.Sender = "客服消息";
             bool value = messageService.Create(message);
         }
     }
     if (message != null)
         return Json(new { messageId = message.MessageId });
     else
         TempData["StatusMessageData"] = new StatusMessageData(StatusMessageType.Hint, "您没有权限对此用户发送私信");
     return Json(new { messageId = 0, hint = new StatusMessageData(StatusMessageType.Hint, "您没有权限对此用户发送私信") });
 }
        public ActionResult _CustomCreateMessage(string spaceKey, long? toUserId)
        {
            MessageEditModel messageEditModel = new MessageEditModel();

            if (toUserId != null && toUserId.Value > 0)
            {
                User user = userService.GetFullUser(toUserId.Value);
                if (user != null)
                {
                    if (!DIContainer.Resolve<Authorizer>().Message(user.UserId))
                        return Json(new StatusMessageData(StatusMessageType.Hint, "该用户不允许你发私信!"), JsonRequestBehavior.AllowGet);
                    ViewData["ToUserDisplayName"] = user.DisplayName;
                }
            }

            ISettingsManager<MessageSettings> messageSettingsManager = DIContainer.Resolve<ISettingsManager<MessageSettings>>();
            ViewData["maxReceiver"] = messageSettingsManager.Get().MaxReceiver;

            return View(messageEditModel);
        }