コード例 #1
0
        /// <summary>
        /// Sends the message to user.
        /// </summary>
        /// <param name="messageDto">The message dto.</param>
        /// <param name="titleDto">The title dto.</param>
        public void SendMessage(PrivateMessageDto messageDto, MessageTitleDto titleDto)
        {
            MessageTitle messageTitle = new MessageTitle();

            messageTitle.FromUserID   = this.userID;
            messageTitle.ToUserID     = titleDto.ToUser.ID;
            messageTitle.Title        = titleDto.Title;
            messageTitle.CreationDate = DateTime.Now;

            this.context.MessageTitles.Add(messageTitle);
            this.context.SaveChanges();

            this.context.PrivateMessages.Add(new PrivateMessage
            {
                Message        = messageDto.Message,
                AuthorID       = this.userID,
                CreationDate   = DateTime.Now,
                MessageTitleID = messageTitle.MessageTitleID
            });
            this.context.SaveChanges();
        }
コード例 #2
0
 /// <summary>
 /// Sends the message to user.
 /// </summary>
 /// <param name="messageDto">The message dto.</param>
 /// <param name="titleDto">The title dto.</param>
 public void SendMessage(PrivateMessageDto messageDto, MessageTitleDto titleDto)
 {
     repository.SendMessage(messageDto, titleDto);
 }