コード例 #1
0
        internal static void SendWallMessageReply(WallMessageReplyBindingModel message, int currentUserId)
        {
            using (DataEntities db = new DataEntities())
            {
                Message msg = new Message
                {
                    Date     = DateTime.Now,
                    Body     = message.Body,
                    SenderId = currentUserId,
                    Type     = (int)MessageTypeEnum.Reply
                };

                WallThread wt = db.WallThreads.Find(message.ThreadId);
                if (wt != null)
                {
                    wt.Messages.Add(msg);
                    db.SaveChanges();
                }
            }
        }
コード例 #2
0
        internal static void SendGameMessage(GameMessageBindingModel message, int currentUserId)
        {
            using (DataEntities db = new DataEntities())
            {
                Message msg = new Message
                {
                    Date     = DateTime.Now,
                    Body     = message.Body,
                    SenderId = currentUserId,
                    Type     = (int)MessageTypeEnum.Root
                };

                WallThread wt = new WallThread
                {
                    GameId    = message.GameId,
                    CreaterId = currentUserId
                };
                wt.Messages.Add(msg);
                db.WallThreads.Add(wt);
                db.SaveChanges();
            }
        }