Example #1
0
        /// <summary>
        ///     Remove the specified user from the room.
        /// </summary>
        /// <param name="user"> The <see cref="User"/> to remove. </param>
        private void RemoveUser(User user)
        {
            var userDto = Mapper.Map <UserModel>(user);

            _chatRoomDataService.RemoveUser(userDto, Id);

            Users.Remove(user);
        }
Example #2
0
        public IActionResult RemoveUser([FromBody] UserModel user, int chatRoomId)
        {
            var removedUserRoom = _chatRoomDataService.RemoveUser(user.Username, chatRoomId);
            var model           = _mapper.Map <UserRoomModel>(removedUserRoom);
            var clientMessage   = new ClientMessage <UserRoomModel>(model)
            {
                OperationType = MessageOperationTypes.Remove
            };

            _messageService.SendMessageToExchange("Chat.Room.RoomId", clientMessage, chatRoomId.ToString());

            return(Ok());
        }