コード例 #1
0
        // GET: api/Chat/5
        public object[] Get(string id, [FromBody] string value)
        {
            GroopsRepository groopsRepository = new GroopsRepository();
            Guid             thisRoomId       = new Guid(id);

            object[] messages = groopsRepository.getAllMessagesForRoom(thisRoomId);
            //Guid roomId = Request.QueryString["userId"];

            //we need to get and return all the messages for that room


            return(messages);
        }
コード例 #2
0
        public void Send(Guid userId, string message, Guid roomId)
        {
            GroopsRepository groopsRepository = new GroopsRepository();
            string           userName         = groopsRepository.addNewComment(userId, message, roomId);

            //add the message to the database
            //how to do that now that we are on the server side
            //I don't think this would be considered part of the API, so we really need to make an api call
            //from here.



            //  Call the addNewMessageToPage method to update clients
            Clients.All.addNewMessageToPage(userName, message, roomId);
        }
コード例 #3
0
        public ActionResult Chat(string id)
        {
            ViewData["roomId"] = id;

            ViewData["userId"] = Request.QueryString["userId"];

            GroopsRepository groopsRepository = new GroopsRepository();

            //for some reason this is getting called twice. I think the second time
            //is because of SignalR/ Sockets firing up
            if (id != "undefined")
            {
                Guid roomId = new Guid(id);

                ViewData["roomName"] = groopsRepository.getRoomNameFromId(roomId);
            }

            return(View());
        }
コード例 #4
0
 public GroopsAPIRoomsController()
 {
     this.groopsRepository = new GroopsRepository();
 }