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(); } } }
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(); } }