Beispiel #1
0
        public async Task RemoveAsync(Guid entityId, IEnumerable <Guid> tagIds)
        {
            var tagIdsList = tagIds.AsList();

            if (tagIdsList.IsEmpty())
            {
                return;
            }
            var uniqueTagIds = tagIdsList.Distinct().AsList();
            await _relationRepository.DeleteAsync(e => uniqueTagIds.Contains(e.UserTagId) && e.EntityId == entityId);
        }
        public async Task RemovePreviewRelationsAsync(Guid activityId)
        {
            var relations  = (await _previewRelationRepository.FindAllAsync(r => r.ActivityId == activityId)).ToList();
            var previewIds = relations.Select(r => r.LinkPreviewId).ToList();
            await _previewRelationRepository.DeleteAsync(relations);

            foreach (var previewId in previewIds)
            {
                if (await _previewRepository.ExistsAsync(p => p.Id == previewId))
                {
                    await _previewRepository.DeleteAsync(previewId);
                }
            }
        }
Beispiel #3
0
        public async Task RemovePreviewRelationsAsync(Guid commentId)
        {
            var relations  = (await _previewRelationRepository.FindAllAsync(r => r.CommentId == commentId)).ToList();
            var previewIds = relations.Select(r => r.LinkPreviewId).ToList();
            await _previewRelationRepository.DeleteAsync(entity => relations.Select(x => x.Id).Contains(entity.Id));

            foreach (var previewId in previewIds)
            {
                await _previewRepository.DeleteAsync(previewId);
            }
        }
Beispiel #4
0
        public async Task DeleteAsync(Guid id)
        {
            var article = await _articleSqlRepository.GetAsync(id);

            if (article == null)
            {
                throw new JppcException(Codes.ArticleNotFound,
                                        $"Article: '{id}' doesn't exists.");
            }

            await _articleSqlRepository.DeleteAsync(id);

            await _articleElasticRepository.DeleteAsync(id);
        }
        public async Task SetAsync(Guid activityId, ActivityLocation location)
        {
            var oldLocation = await _locationRepository
                              .AsQueryable()
                              .SingleOrDefaultAsync(l => l.ActivityId == activityId);

            if (oldLocation is null)
            {
                if (location is null)
                {
                    return;
                }

                var newLocation = new ActivityLocationEntity()
                {
                    ActivityId   = activityId,
                    Address      = location.Address,
                    ShortAddress = location.ShortAddress
                };

                await _locationRepository.AddAsync(newLocation);
            }
            else
            {
                if (location?.Address == null || location.ShortAddress == null)
                {
                    await _locationRepository.DeleteAsync(oldLocation.Id);
                }
                else
                {
                    oldLocation.Address      = location.Address;
                    oldLocation.ShortAddress = location.ShortAddress;
                    await _locationRepository.UpdateAsync(oldLocation);
                }
            }
        }
Beispiel #6
0
        protected virtual async Task DeleteAsync(Comment comment)
        {
            async Task<IEnumerable<Comment>> GetDescendants(Comment current) =>
                (await (await _commentsRepository
                        .FindAllAsync(c => c.ParentId == current.Id))
                    .SelectManyAsync(GetDescendants))
                .Append(current);

            var commentsToDelete = await GetDescendants(comment);

            commentsToDelete.ToList().ForEach(async c =>
            {
                await _commentLinkPreviewService.RemovePreviewRelationsAsync(c.Id);
                await _commentsRepository.DeleteAsync(c);
            });
        }
Beispiel #7
0
        public async Task DeleteAsync(Entry entry)
        {
            if (!entry.IsDeleted)
            {
                await _entryRepository.DeleteAsync(entry);
            }
            else
            {
                var reader = await _entryRepository.ExecuteSqlAsync(
                    $"DELETE FROM [Entries] where [Id] = {entry.Id} AND [IsDeleted] = 1"
                    );

                if (!reader.IsClosed)
                {
                    reader.Close();
                }
            }
        }
Beispiel #8
0
 public async Task RemoveAsync(Guid userId, Guid entityId)
 {
     await _likesRepository.DeleteAsync(like => like.EntityId == entityId && like.UserId == userId);
 }
Beispiel #9
0
        public async Task DeletePermissionsForMemberGroupAsync(int memberGroupId)
        {
            await _permissionsRepository.DeleteAsync(i => i.IntranetMemberGroupId == memberGroupId);

            CurrentCache = null;
        }
Beispiel #10
0
 public async Task RemoveRelationAsync(Guid groupId, Guid activityId)
 {
     await _groupActivityRepository.DeleteAsync(r => r.ActivityId.Equals(activityId) && r.GroupId.Equals(groupId));
 }
Beispiel #11
0
 public async Task DeleteAsync(Guid id)
 {
     await _myLinksRepository.DeleteAsync(id);
 }
 public virtual Task DeleteAsync(Guid activityId)
 {
     return(_activitySubscribeSettingRepository.DeleteAsync(setting => setting.ActivityId == activityId));
 }
        public async Task RemoveAsync(Guid groupId, Guid memberId)
        {
            await _groupMemberRepository.DeleteAsync(IsGroupAndUserMatch(memberId, groupId));

            await _memberCacheService.UpdateMemberCacheAsync(memberId);
        }
 public Task DeleteAsync(GroupDocument document)
 {
     return(_repository.DeleteAsync(document.Id));
 }
Beispiel #15
0
 public async Task DeleteAsync(Guid entityId)
 {
     await _sqlRepository.DeleteAsync(m => m.EntityId == entityId);
 }
 public async Task DeleteAsync(Guid id)
 {
     await _sqlRepository.DeleteAsync(id);
 }