Esempio n. 1
0
        public IActionResult Index()
        {
            if (_dataContext.Folders.Count() == 0)
            {
                var folder = new MediaFolder();
                folder.Title = "Lilled";

                var photo = new Photo();
                photo.Title    = "Lill 2";
                photo.FileName = "lill2.jpg";
                folder.Items.Add(photo);

                _dataContext.Folders.Add(folder);

                var subFolder = new MediaFolder();
                subFolder.Title        = "Roosid";
                subFolder.ParentFolder = folder;

                photo              = new Photo();
                photo.Title        = "Lill 1";
                photo.FileName     = "lill1.jpg";
                photo.ParentFolder = subFolder;
                subFolder.Items.Add(photo);
                folder.Items.Add(subFolder);

                _dataContext.Folders.Add(subFolder);

                folder       = new MediaFolder();
                folder.Title = "Majad";
                _dataContext.Folders.Add(folder);

                folder       = new MediaFolder();
                folder.Title = "Söögid";
                _dataContext.Folders.Add(folder);

                photo          = new Photo();
                photo.Title    = "Pealkiri 1";
                photo.FileName = "pilt.jpg";
                _dataContext.Photos.Add(photo);

                photo          = new Photo();
                photo.Title    = "Pealkiri 2";
                photo.FileName = "pilt2.jpg";
                _dataContext.Photos.Add(photo);

                photo          = new Photo();
                photo.Title    = "Pealkiri 3";
                photo.FileName = "pilt3.jpg";
                _dataContext.Photos.Add(photo);

                _dataContext.SaveChanges();
            }

            var model = new FrontPageModel();

            model.NewPhotos     = _dataContext.Photos.Cast <MediaItem>().ToList();
            model.PopularPhotos = _dataContext.Photos.Cast <MediaItem>().ToList();

            return(View(model));
        }
Esempio n. 2
0
        public ActionResult ConfigFrontPage()
        {
            FrontPageModel frontPage = PublicBiz.GetInstant().getCurFrontPage();

            ViewData[typeof(FrontPageModel).Name] = frontPage;
            return(View());
        }
Esempio n. 3
0
        public ActionResult Index()
        {
            PublicBiz      publicBiz = PublicBiz.GetInstant();
            FrontPageModel frontPage = publicBiz.getCurFrontPage();


            string[]         cityNames = frontPage.homeHotCityNameArray.Split(',');
            GeoBiz           geoBiz    = GeoBiz.GetInstant();
            IList <GeoModel> geos      = new List <GeoModel>();

            foreach (string cityName in cityNames)
            {
                GeoModel geo = geoBiz.GetGeoByCityName(cityName);
                geo.geoCls = geoBiz.GetGeoCls(geo.id);
                geo.geoDs  = geoBiz.GetGeoDs(geo.id);
                geo.geoLls = geoBiz.GetGeoLls(geo.id);
                geos.Add(geo);
            }
            ViewData[typeof(IList <GeoModel>).Name] = geos;
            this.VdCityTopHotel(20, cityNames);
            this.VdHotBookingHotel(10);
            this.VdHotBrand(12);
            this.VdHotCity(15);

            this.setPageDesc(PublicBiz.getCurPageSeo().hotelIndexDesc);
            this.setPageKeyWords(PublicBiz.getCurPageSeo().hotelIndexKeywords);

            return(View());
        }
Esempio n. 4
0
 public async Task<FrontPageModel> GetFrontPageModelAsync()
 {
       var threeAmigosHeaderArticles=await this.articlesQuery.GetThreeAmigos();
       var otherArticles=await this.articlesQuery.GetOtherFrontPageArticles();
       FrontPageModel model = new FrontPageModel(threeAmigosHeaderArticles.OrderBy(x => x.Position),otherArticles.OrderBy(x => x.Position));
       return model;
   }
Esempio n. 5
0
        public IActionResult Index()
        {
            if (_dataContext.Photos.Count() == 0)
            {
                var photo = new Photo();
                photo.Title    = "Pealkiri 1";
                photo.FileName = "pilt.jpg";
                _dataContext.Photos.Add(photo);

                photo          = new Photo();
                photo.Title    = "Pealkiri 2";
                photo.FileName = "pilt2.jpg";
                _dataContext.Photos.Add(photo);

                photo          = new Photo();
                photo.Title    = "Pealkiri 3";
                photo.FileName = "pilt3.jpg";
                _dataContext.Photos.Add(photo);

                _dataContext.SaveChanges();
            }

            var model = new FrontPageModel();

            model.NewPhotos     = _dataContext.Photos.Cast <MediaFile>().ToList();
            model.PopularPhotos = _dataContext.Photos.Cast <MediaFile>().ToList();

            return(View(model));
        }
Esempio n. 6
0
        public IActionResult Index()
        {
            var model = new FrontPageModel();
            model.Top5 = _context.Products.Take(5);
            model.Items = _context.Products.Take(10);

            return View(model);
        }
Esempio n. 7
0
        public ActionResult DoSaveFrontPage()
        {
            FrontPageModel frontPage = PublicBiz.GetInstant().getCurFrontPage();

            frontPage = WebUtil.Eval <FrontPageModel>(frontPage, "", "");
            JsResultObject re = BaseZdBiz.Update(frontPage, "首页配置");

            return(JsonText(re, JsonRequestBehavior.AllowGet));
        }
Esempio n. 8
0
        public IActionResult Index()
        {
            var model = new FrontPageModel();

            model.NewPhotos     = _dataContext.Photos.Cast <MediaItem>().ToList();
            model.PopularPhotos = _dataContext.Photos.Cast <MediaItem>().ToList();

            return(View(model));
        }
Esempio n. 9
0
    public async Task Index_OnGet_ReturnsFrontPageModel()
    {
        FrontPageModel model = new FrontPageModel(TestArticles,TestArticles2);
        var service = Substitute.For<IFrontPageService>();
        var sut = new HomeController(service);

        service.GetFrontPageModelAsync().Returns(Task.FromResult(model));

        IActionResult viewResult = await sut.Index();
        Assert.True((viewResult as ViewResult).ViewData.Model is FrontPageModel);
    }
Esempio n. 10
0
        public IActionResult Index()
        {
            var model = new FrontPageModel();

            model.NewPhotos     = _dataContext.Photos.Cast <MediaItem>().ToList();
            model.PopularPhotos = _dataContext.Photos.Cast <MediaItem>().ToList();

            var path = _galleryContext.GetFolderPath(8, "lill.jpg");

            return(View(model));
        }
Esempio n. 11
0
    public async Task <FrontPageModel> GetFrontPageModelAsync()
    {
        var threeAmigosHeaderArticles = await this.articlesQuery.GetThreeAmigos();

        var            otherArticles = (await this.twitterQuery.GetTop10TweetsFrom()).Select(x => x.ToShortArticle());
        FrontPageModel model         =
            new FrontPageModel(threeAmigosHeaderArticles.OrderBy(x => x.Position),
                               otherArticles.OrderByDescending(x => x.CreatedAt), this.deploymentSlot.Name);

        return(model);
    }
Esempio n. 12
0
        //
        // GET: /FrontPage/

        public ActionResult FrontPage(RenderModel renderModel)
        {
            var model = new FrontPageModel()
            {
                Header       = CurrentPage.GetPropertyValue <string>("header"),
                BodyText     = CurrentPage.GetPropertyValue <IHtmlString>("bodyText"),
                Image        = GetImage(),
                FeaturedNews = NewsItemMapper.Map <NewsItem>(CurrentPage.Children.FirstOrDefault(x => x.IsDocumentType("NewsPage")))
            };

            return(View(model));
        }
Esempio n. 13
0
        public IActionResult Index(int page = 1)
        {
            page = Math.Max(1, page);

            var inRole = User.IsInRole("Admin");
            var model  = new FrontPageModel();

            model.AllPhotos = _dataContext.Photos
                              .Cast <MediaItem>()
                              .GetPaged(page, 5);

            model.NewPhotos     = _dataContext.Photos.Cast <MediaItem>().ToList();
            model.PopularPhotos = _dataContext.Photos.Cast <MediaItem>().ToList();

            return(View(model));
        }
 public ActionResult Index()
 {
     using (MyDbEntities DB = new MyDbEntities())
     {
         var            A                = DB.UserDatas;
         var            totalUsers       = DB.UserDatas.Count();
         var            totalAdmins      = DB.Admins.Count();
         var            totalCelebrities = DB.Celebrities.Count();
         var            blocks           = DB.UserDatas.Where(t => t.BlockStatus == true).Count();
         FrontPageModel fr               = new FrontPageModel();
         fr.tAdmins      = totalAdmins;
         fr.tCelebrities = totalCelebrities;
         fr.tUsers       = totalUsers;
         fr.blockedUsers = blocks;
         return(View(fr));
     }
 }
Esempio n. 15
0
        public Master GetContent(SpaSiteModel site, IPublishedContent content)
        {
            if (content.HasProperty(SkyConstants.Properties.UmbracoInternalRedirect) && content.HasValue(SkyConstants.Properties.UmbracoInternalRedirect))
            {
                content = new UmbracoHelper(UmbracoContext.Current).TypedContent(content.GetPropertyValue <Udi>(SkyConstants.Properties.UmbracoInternalRedirect));
            }

            switch (content.DocumentTypeAlias)
            {
            case SkyConstants.DocumentTypes.FrontPage:
                return(FrontPageModel.GetFromContent(site, content));

            case SkyConstants.DocumentTypes.SubPage:
                return(SubPageModel.GetFromContent(site, content));

            default:
                return(null);
            }
        }
Esempio n. 16
0
        public ActionResult Search(string cityName, string keyWord, string geoClId, string geoDId, DateTime?checkInDate)
        {
            PublicBiz      publicBiz = PublicBiz.GetInstant();
            FrontPageModel frontPage = publicBiz.getCurFrontPage();
            GeoBiz         geoBiz    = GeoBiz.GetInstant();
            GeoModel       geo       = geoBiz.GetGeoByCityName(cityName);

            this.VdGeoLocation(geo);
            GeoLocationModel geoLocation = null;
            PageSeoModel     seo         = PublicBiz.getCurPageSeo();

            this.setPageDesc(string.Format(seo.cityDesc, geo.cityCode, geo.cityName));
            this.setPageKeyWords(string.Format(seo.cityKeywords, geo.cityCode, geo.cityName));
            if (!string.IsNullOrEmpty(geoClId))
            {
                geoLocation = BaseZdBiz.Load <GeoCommercialLocationModel>(Restrictions.Eq("geoFk", geo.id), Restrictions.Eq("locationId", geoClId));
                this.setPageDesc(string.Format(seo.cityClDesc, geo.cityCode, geo.cityName, geoLocation.locationId, geoLocation.name));
                this.setPageKeyWords(string.Format(seo.cityClKeywords, geo.cityCode, geo.cityName, geoLocation.locationId, geoLocation.name));
            }
            else if (!string.IsNullOrEmpty(geoDId))
            {
                geoLocation = BaseZdBiz.Load <GeoDistrictsModel>(Restrictions.Eq("geoFk", geo.id), Restrictions.Eq("locationId", geoDId));
                this.setPageDesc(string.Format(seo.cityDDesc, geo.cityCode, geo.cityName, geoLocation.locationId, geoLocation.name));
                this.setPageKeyWords(string.Format(seo.cityDKeywords, geo.cityCode, geo.cityName, geoLocation.locationId, geoLocation.name));
            }
            else if (!string.IsNullOrEmpty(keyWord))
            {
                this.setPageDesc(string.Format(seo.hotelSearchDesc, cityName, keyWord, (checkInDate ?? DateTime.Now).ToShortDateString()));

                this.setPageKeyWords(string.Format(seo.hotelSearchKeywords, cityName, keyWord, (checkInDate ?? DateTime.Now).ToShortDateString()));
            }
            ViewData[typeof(GeoLocationModel).Name] = geoLocation;

            ICriteria icr = BaseZdBiz.CreateCriteria <BrandModel>();

            string[] brandNames = frontPage.searchBrandNameArray.Split(',');
            icr.Add(Restrictions.In("brandName", brandNames));
            IList <BrandModel> brands = icr.List <BrandModel>();

            ViewData[typeof(BrandModel).Name] = brands;
            this.VdHotCity(15);
            return(View());
        }
Esempio n. 17
0
        public IActionResult Index()
        {
            FrontPageModel model     = new FrontPageModel();
            var            message   = "Hello Michael";
            int            age       = 41;
            string         LastName  = "Talltree";
            string         FirstName = "Joshua";
            string         homeTown  = "San Antonio";
            string         homeState = "Texas";


            model.MyMessage = message;
            model.Age       = age;
            model.LastName  = LastName;
            model.FirstName = FirstName;
            model.homeTown  = homeTown;
            model.homeState = homeState;
            return(View(model));
        }
        /// <summary>
        /// This is our Index method
        /// </summary>
        /// <returns>It returns five surveys, customers and users, all in descending order</returns>
        //
        // GET: /Home/
        public ActionResult Index()
        {
            //Get five last Customer surveys
            List <CustomerSurvey> lastFiveCustomerSurveys = db.CustomerSurveys.OrderByDescending(x => x.surveyId).Take(5).ToList();
            //Get five last Customers
            List <Customer>    lastFiveCustomers = db.Customers.OrderByDescending(x => x.customerId).Take(5).ToList();
            List <UserAccount> lastFiveUsers     = db.UserAccounts.OrderByDescending(x => x.userId).Take(5).ToList();

            FrontPageModel frontPageView = new FrontPageModel(lastFiveCustomerSurveys, lastFiveCustomers, lastFiveUsers);

            //Stats
            Dictionary <string, int> stats = new Dictionary <string, int>();

            stats.Add("Users", db.UserAccounts.Count());
            stats.Add("Customers", db.Customers.Count());
            stats.Add("Surveys", db.CustomerSurveys.Count());
            stats.Add("Base Surveys", db.GenericSurveys.Count());
            stats.Add("Questions", db.Questions.Count());

            ViewBag.Stats = stats;

            return(View(frontPageView));
        }
Esempio n. 19
0
        public ActionResult Index()
        {
            GeoBiz         geoBiz    = GeoBiz.GetInstant();
            PublicBiz      publicBiz = PublicBiz.GetInstant();
            FrontPageModel frontPage = publicBiz.getCurFrontPage();


            // icr=BaseZdBiz.CreateCriteria<HotelCommentModel>(new PagerObject(1,10));
            // IList<HotelCommentModel> listComment = icr.List<HotelCommentModel>();
            // ViewData[typeof(HotelCommentModel).Name] = listComment;

            this.VdHotNews(4);
            this.VdHotBrand(16);
            string[] cityNames = frontPage.homeHotCityNameArray.Split(',');
            this.VdCityTopHotel(10, cityNames);
            this.VdHotBookingHotel(10);
            this.VdHotCommentHotel(10);
            this.VdHotCity(15);

            this.setPageDesc(PublicBiz.getCurPageSeo().homeIndexDesc);
            this.setPageKeyWords(PublicBiz.getCurPageSeo().homeIndexKeywords);
            return(View());
        }
Esempio n. 20
0
        public int imageNum   = 3; //Images to get each time we get new ones

        /// <summary>
        ///     Gets the front page view with images and information
        /// </summary>
        /// <returns>Returns the view to the front page of the website</returns>
        public ActionResult Index()
        {
            var articles = filterArticles(0, articleNum);
            var carousel = _context.Carousel.ToList();
            IList <CarouselObject> carouselList = new List <CarouselObject>();

            if (carousel.Any() && carousel.First().Enabeled)
            {
                foreach (var file in carousel.First().CarouselItems)
                {
                    if (file.FileType == DbTables.FileType.CarouselImage)
                    {
                        carouselList.Add(new CarouselObject {
                            id = file.FileId, type = "image"
                        });
                    }
                    else
                    {
                        carouselList.Add(new CarouselObject {
                            id = file.FileId, type = "video"
                        });
                    }
                }
            }
            else
            {
                carouselList = null;
            }
            var About     = new DbTables.Info(); //get about model
            var AboutList = _context.About.ToList();

            if (AboutList.Any())
            {
                About = AboutList.First();
            }
            var background     = new DbTables.BackgroundImage();
            var backgroundList = _context.BackgroundImage.ToList();

            if (backgroundList.Any())
            {
                background = backgroundList.First();
                if (background.Enabeled) //if background is in database and available, return
                {
                    ViewBag.Style = "background:url('/File/Background?id=" + background.Image.FileId +
                                    //adds background to viewbag
                                    "') no-repeat center center fixed;-webkit-background-size: cover;-moz-background-size: cover;-o-background-size: cover;background-size: cove;overflow-x: hidden;";
                    ViewBag.BackGround = "background-color:transparent;";
                }
            }
            var stripeList = _context.StripeAPI.ToList();

            if (stripeList.Any())
            {
                if (stripeList.First().Enabeled)
                {
                    ViewBag.StripePublic = stripeList.First().Public;
                }
            }

            var subscriptions = _context.Subscriptions.Where(s => s.Enabeled).ToList();
            var donations     = new Donations
            {
                Subscriptions = subscriptions
            };

            if (!string.IsNullOrEmpty(About.DonateText))
            {
                donations.DonationText = About.DonateText;
            }
            var model = new FrontPageModel
            {
                Articles  = articles,
                Carousel  = carouselList,
                About     = About,
                Donations = donations
            };

            return(View(model));
        }