/// <summary> /// 创建私信 /// </summary> /// <param name="message">待创建的私信实体</param> /// <returns>是否删除成功:true-成功,false-不成功</returns> public bool Create(Message message) { if (message == null) return false; EventBus<Message>.Instance().OnBefore(message, new CommonEventArgs(EventOperationType.Instance().Create())); long id = 0; long.TryParse(messageRepository.Insert(message).ToString(), out id); EventBus<Message>.Instance().OnAfter(message, new CommonEventArgs(EventOperationType.Instance().Create())); return id > 0; }
/// <summary> /// 新建实体时使用 /// </summary> public static Message New() { Message message = new Message() { Sender = string.Empty, Receiver = string.Empty, Subject = string.Empty, Body = string.Empty, IP = WebUtility.GetIP(), IsRead = false, MessageType = Common.MessageType.Common, DateCreated = DateTime.UtcNow }; return message; }