Example #1
0
        public ActionResult HomepageGallery(int? page)
        {
            using (var context = new olympicsEntities())
            {
                // Perform data access using the context
                var adverts = from a in context.sporteventstables
                              where a.ss_id == 1 && !string.IsNullOrEmpty(a.strimage1) && a.strapproved == "yes"
                              orderby a.strdatetime descending
                              select a;

                int pageSize = 9;
                int pageNumber = (page ?? 1);
                return PartialView(adverts.ToPagedList(pageNumber, pageSize));
            }
        }
Example #2
0
        public ActionResult HomeDiscover()
        {
            //dbContext get content from table: cms where contentAliasType = "homeDiscover"

            // Perform data access using the context
            using (var context = new olympicsEntities())
            {
                // Perform data access using the context
                var hd = from a in context.cms
                         where a.SS_ID == 1 && a.contentTypeAlias == "homeDiscover"
                         select a.content;

                var viewModel = new HomeDiscoverViewModel()
                {
                    homeDiscover = hd.FirstOrDefault().ToString()
                };

                return PartialView(viewModel);
            }
        }
Example #3
0
 public AdvertRepository(olympicsEntities context)
 {
     this.context = context;
 }