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(); } }
public IHttpActionResult PostTeamMessage(TeamMessageBindingModel message) { MessagesService.SendTeamMessage(message, CurrUserId); return(Ok()); }