Ejemplo n.º 1
0
        public async Task AddSubscriberAsync(Guid remarkId, string userId)
        {
            var subsribers = await _repository.GetByIdAsync(remarkId);

            if (subsribers.HasNoValue)
            {
                Logger.Debug($"RemarkSubsribers not found for remarkId: {remarkId}. Creating new one.");
                subsribers = new RemarkSubscribers(remarkId);
            }
            subsribers.Value.AddSubscriber(userId);
            Logger.Debug($"Add subscriber. remarkId: {remarkId}, userId: {userId}");
            await _repository.AddOrUpdateAsync(subsribers.Value);
        }
Ejemplo n.º 2
0
 public static async Task AddOrUpdateAsync
     (this IMongoCollection <RemarkSubscribers> collection, RemarkSubscribers subscribers)
 => await collection.ReplaceOneAsync(x => x.RemarkId == subscribers.RemarkId, subscribers, new UpdateOptions
 {
     IsUpsert = true
 });
 protected async Task <IEnumerable <UserNotificationSettings> > GetUsersAsync(RemarkSubscribers subscribers)
 => await _userNotificationSettingsService
 .BrowseSettingsAsync(subscribers.Users);
Ejemplo n.º 4
0
 public async Task AddOrUpdateAsync(RemarkSubscribers subscribers)
 => await _database.RemarkSubscribers().AddOrUpdateAsync(subscribers);