Esempio n. 1
0
        private void DeleteJournalItem(int portalId, int currentUserId, int journalId, bool softDelete)
        {
            var ji      = GetJournalItem(portalId, currentUserId, journalId);
            var groupId = ji.SocialGroupId;

            if (softDelete)
            {
                _dataService.Journal_SoftDelete(journalId);
            }
            else
            {
                _dataService.Journal_Delete(journalId);
            }

            if (groupId > 0)
            {
                UpdateGroupStats(portalId, groupId);
            }
        }
        private void DeleteJournalItem(int portalId, int currentUserId, int journalId, bool softDelete)
        {
            var ji = GetJournalItem(portalId, currentUserId, journalId, !softDelete);

            if (ji == null)
            {
                return;
            }

            var groupId = ji.SocialGroupId;

            if (softDelete)
            {
                _dataService.Journal_SoftDelete(journalId);
            }
            else
            {
                _dataService.Journal_Delete(journalId);
            }

            if (groupId > 0)
            {
                UpdateGroupStats(portalId, groupId);
            }

            // queue remove journal from search index
            var document = new SearchDocumentToDelete
            {
                PortalId     = portalId,
                AuthorUserId = currentUserId,
                UniqueKey    = ji.ContentItemId.ToString("D"),
                //QueryString = "journalid=" + journalId,
                SearchTypeId = SearchHelper.Instance.GetSearchTypeByName("module").SearchTypeId
            };

            if (groupId > 0)
            {
                document.RoleId = groupId;
            }

            DataProvider.Instance().AddSearchDeletedItems(document);
        }