Ejemplo n.º 1
0
        public async Task <CommentView> DeleteAsync(long id, Requester requester)
        {
            var uid      = requester.userId;
            var existing = await ExistingCheckAsync(id);

            var parent = await ModifyCheckAsync(existing, requester);

            var copy = MakeHistoryCopy(existing, Keys.CommentDeleteHack, uid);

            existing.value     = "";
            existing.entityId2 = 0;
            await provider.WriteAsync(copy, existing);

            var relationPackage = (await converter.LinkAsync(new[] { existing })).OnlySingle();

            return(converter.ToView(relationPackage));
        }
        public async Task <CommentView> DeleteAsync(long id, Requester requester)
        {
            //Even if it doesn't succeed, get rid of it asap
            singlecache.FlushKeys(new[] { id });

            var uid      = requester.userId;
            var existing = await ExistingCheckAsync(id);

            var parent = await ModifyCheckAsync(existing, requester);

            var copy = MakeHistoryCopy(existing, Keys.CommentDeleteHack, uid);

            existing.value     = "";
            existing.entityId2 = 0;
            await provider.WriteAsync(copy, existing);

            var relationPackage = (await converter.LinkAsync(new List <EntityRelation>()
            {
                existing
            })).OnlySingle();

            return(converter.ToView(relationPackage));
        }