Example #1
0
        public List <GetTextCommentContract> GetCommentsForText(long textId)
        {
            var dbResult     = m_resourceRepository.InvokeUnitOfWork(x => x.GetCommentsForText(textId));
            var contractList = m_mapper.Map <List <GetTextCommentContract> >(dbResult);
            var result       = m_userDetailManager.AddUserDetails(contractList);

            return(result);
        }
Example #2
0
        public PagedResultList <FeedbackContract> GetFeedbackList(int?start, int?count, FeedbackSortEnumContract sort,
                                                                  SortDirectionEnumContract sortDirection, IList <FeedbackCategoryEnumContract> filterCategories, PortalTypeContract portalTypeContract)
        {
            var startValue           = PagingHelper.GetStart(start);
            var countValue           = PagingHelper.GetCount(count);
            var sortValue            = m_mapper.Map <FeedbackSortEnum>(sort);
            var filterCategoryValues = m_mapper.Map <List <FeedbackCategoryEnum> >(filterCategories);
            var portalType           = m_mapper.Map <PortalTypeEnum>(portalTypeContract);

            var result = m_portalRepository.InvokeUnitOfWork(repository =>
            {
                var dbFeedbacks = repository.GetFeedbackList(startValue, countValue, sortValue, sortDirection, filterCategoryValues, portalType);

                var headwordFeedbackIds = dbFeedbacks.List.Where(x => x.FeedbackType == FeedbackType.Headword)
                                          .Select(x => x.Id);
                repository.FetchHeadwordFeedbacks(headwordFeedbackIds);

                return(dbFeedbacks);
            });

            return(new PagedResultList <FeedbackContract>
            {
                List = m_userDetailManager.AddUserDetails(m_mapper.Map <List <FeedbackContract> >(result.List)),
                TotalCount = result.Count,
            });
        }
Example #3
0
        public PagedResultList <NewsSyndicationItemContract> GetNewsSyndicationItems(int?start, int?count, NewsTypeEnumContract?itemType, PortalTypeContract portalTypeContract)
        {
            var startValue          = PagingHelper.GetStart(start);
            var countValue          = PagingHelper.GetCount(count);
            var syndicationItemType = m_mapper.Map <SyndicationItemType?>(itemType);
            var portalType          = m_mapper.Map <PortalTypeEnum>(portalTypeContract);

            var result = m_portalRepository.InvokeUnitOfWork(x =>
                                                             x.GetNewsSyndicationItems(startValue, countValue, syndicationItemType, portalType));

            return(new PagedResultList <NewsSyndicationItemContract>
            {
                List = m_userDetailManager.AddUserDetails(m_mapper.Map <List <NewsSyndicationItemContract> >(result.List)),
                TotalCount = result.Count
            });
        }