示例#1
0
        public ActionResult AllReports(int?pageno)
        {
            //var Allreports = (from l in db.ReportMasters
            //                  join c in db.CategoryMasters
            //                  on l.CategoryId equals c.CategoryId
            //                  join p in db.PublisherMasters
            //                  on l.PublisherId equals p.PublisherId
            //                  orderby l.CreatedDate descending
            //                  //where l.FullDescription.Replace("<[^>]+>|&nbsp;", "").Trim().Contains(@"<[^>]+>|&nbsp;", "")
            //                  select new ReportVM
            //                  {
            //                      ReportTitle = l.ReportTitle,
            //                      ReportUrl = l.ReportURL,
            //                      FullDescription = l.FullDescription.Substring(0, 300),
            //                      NumberOfPage = l.NumberOfPage,
            //                      CategoryId = l.CategoryId,
            //                      PublishingDate = l.PublishingDate,
            //                      PriceSingleUser = l.PriceSingleUser,
            //                      CategoryName = c.CategoryName,
            //                      CategoryUrl=c.CategoryUrl,
            //                      PublisherName=p.CompanyName,
            //                      PublisherId=p.PublisherId,
            //                      PublishingUrl=p.PublisherUrl
            //                  }).ToList();
            ViewBag.activemenu = "Report";
            ObjectParameter count = new ObjectParameter("p_Count", 0);

            var Allreports = (from r in db.spNewAllLatestReport(pageno ?? 1, count).ToList()
                              select new ReportVM
            {
                ReportTitle = r.ReportTitle,
                CategoryId = r.CategoryId,
                PublishingDate = Convert.ToDateTime(r.PublishingDate),
                ReportUrl = r.ReportUrl,
                PriceSingleUser = r.SinglePrice,
                FullDescription = r.LongDescription,
                NumberOfPage = r.NumberOfPages,
                CategoryName = r.CategoryName,
                CategoryUrl = r.CategoryUrl,
                PublisherName = r.PublisherName,
                PublisherId = r.PublisherId,
                PublishingUrl = r.publisherUrl,
                RepImageCat = 0
            }).ToList();

            foreach (var item in Allreports)
            {
                item.ReportImage = DDLGetparents(item.CategoryId);
            }

            var result = Allreports.Select(x => new ReportVM
            {
                ReportTitle     = x.ReportTitle,
                ReportUrl       = x.ReportUrl,
                FullDescription = Regex.Replace(x.FullDescription, @"<[^>]+>|&nbsp;", "").Trim(),
                NumberOfPage    = x.NumberOfPage,
                CategoryId      = x.CategoryId,
                PublishingDate  = x.PublishingDate,
                PriceSingleUser = x.PriceSingleUser,
                CategoryName    = x.CategoryName,
                CategoryUrl     = x.CategoryUrl,
                PublisherName   = x.PublisherName,
                PublisherId     = x.PublisherId,
                PublishingUrl   = x.PublishingUrl,
                ReportImage     = x.ReportImage
            }).ToList();

            var reports = new StaticPagedList <ReportVM>(result, pageno ?? 1, 10, Convert.ToInt32(count.Value));

            ViewBag.Totalreports = reports.TotalItemCount;
            ViewBag.Title        = "All Latest Market Research Reports | Excellent Market Research";
            ViewBag.Description  = "Excellent Market Research  Provides All Latest Market Research Reports of Different Categories and Custom Reports";
            ViewBag.Keywords     = "Latest Reports, Trending Reports, Custom Reports, ";

            return(View(reports));
        }