예제 #1
0
        /// <inheritdoc/>
        public ChannelDataDto CreateDto(Channel sourceObject)
        {
            var dto = new ChannelDataDto
            {
                Id       = sourceObject.Id,
                Messages = _messageFactory.CreateDtoList(sourceObject.Messages)
            };

            return(dto);
        }
예제 #2
0
        /// <inheritdoc/>
        public ServerDataDto CreateDto(Server sourceObject)
        {
            var dto = new ServerDataDto
            {
                Id          = sourceObject.Id,
                ChannelList = _channelFactory.CreateDtoList(sourceObject.Channels),
                UserList    = _userFactory.CreateDtoList(sourceObject.Users)
            };

            return(dto);
        }
예제 #3
0
        /// <inheritdoc/>
        public List <MessageDto> GetChannelMessages(int channelId,
                                                    IChatDtoFactory <Message, MessageDto> dtoFactory,
                                                    IChatEntityRepositoryProxy <Channel, ChatDbContext> channelRepo)
        {
            var channel = channelRepo.Find(channelId);

            _requestValidator.IsChannelRequestValid(channel, channel.Server, _user, PermissionTypes.CanView);

            //TODO Pagination, return 20-40 messages in one batch
            return(dtoFactory.CreateDtoList(channel.Messages));
        }
예제 #4
0
 /// <inheritdoc/>
 public List <ServerIconDto> GetUserServers(IChatDtoFactory <Server, ServerIconDto> dtoFactory)
 {
     return(dtoFactory.CreateDtoList(_user.Servers));
 }