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

                WallThread wt = new WallThread
                {
                    TeamId    = message.TeamId,
                    CreaterId = currentUserId
                };
                wt.Messages.Add(msg);
                db.WallThreads.Add(wt);
                db.SaveChanges();
            }
        }
コード例 #2
0
 public IHttpActionResult PostTeamMessage(TeamMessageBindingModel message)
 {
     MessagesService.SendTeamMessage(message, CurrUserId);
     return(Ok());
 }