public static Channel SyncChannels(TwitchChannel twitchChannel, Channel channel)
        {
            channel.CreatedAt = twitchChannel.CreatedAt;
            channel.UpdatedAt = twitchChannel.UpdatedAt;
            channel.TwitchChannelName = twitchChannel.Name;
            channel.TwitchChannelId = twitchChannel.Id;

            if (channel.Urls.Any(u => u.TheUrl != twitchChannel.Url))
            {
                channel.Urls.Add(new Url { TheUrl = twitchChannel.Url, CreatedAt = DateTime.Now });
            }

            return channel;
        }
Example #2
0
        public static Channel CreateChannel(Guid clientId, TwitchChannel twitchChannel)
        {
            var channel = ChannelSyncService.SyncChannels(twitchChannel, ChannelMethods.CreateChannel());

            channel.PublicChannelId = IdSupplier.GetPublicID(clientId, twitchChannel.Id);

            channel.OwnerId = clientId;

            channel.ChannelLogger = ChannelLoggerService.CreateNewChannelLogger();

            channel.DailyActivities.Add(ChannelMethods.NewActivity(channel.ChannelId));

            channel.Statistic = StatisticService.CreateNewStatistic();

            return channel;
        }