예제 #1
0
        public ActionResult GetProviders()
        {
            var result = new List <ProviderPublicViewModel>();

            using (ContextManager.NewConnection())
            {
                result = Mapper.Map <List <ProviderPublicViewModel> >(providerService.Search(
                                                                          new ProviderQueryModel()
                {
                    StatusId = EnumHelper.ProviderStatuses[ProviderStatus.Valid]
                }));
            }

            PublicContentHelper.DecodeAndTrimContent(result, ConfigurationReader.ProviderTrimLength);
            return(PartialView("_Providers", result));
        }
예제 #2
0
        public ActionResult LatestNews(int count = 2)
        {
            List <Publication> result;

            using (ContextManager.NewConnection())
            {
                result = publicationService.GetVisiblePublicationsByType(PublicationType.News);
            }

            result = result
                     .Where(item => item.IsLead)
                     .OrderByDescending(item => item.StartDate)
                     .Take(count)
                     .ToList();
            var data = Mapper.Map <List <PublicationPublicViewModel> >(result);

            PublicContentHelper.DecodeAndTrimContent(data, ConfigurationReader.LeadNewsTrimLength);
            return(PartialView("_LatestNews", data));
        }
        private ActionResult GetActivePublicationsByType(
            PublicationType type,
            Func <PublicationPublicViewModel, bool> filter = null)
        {
            List <Publication> result;

            using (ContextManager.NewConnection())
            {
                result = publicationService.GetVisiblePublicationsByType(type);
            }

            var publications = Mapper.Map <List <PublicationPublicViewModel> >(result ?? new List <Publication>());

            if (filter != null)
            {
                publications = publications.Where(filter).ToList();
            }

            PublicContentHelper.DecodeAndTrimContent(publications, ConfigurationReader.TrimLength);
            InitBreadcrumb(type == PublicationType.News ? Resource.News : Resource.Events);
            ViewBag.PublicationType = type;
            return(View("Publications", publications));
        }