private void BuildViewModel(Item item)
 {
     _model = new LandingPageViewModel
     {
         BreadcrumbItems = BreadcrumbItems
     };
 }
コード例 #2
0
        public IActionResult LandingPage()
        {
            ApplicationUser      applicationUser = _context.ApplicationUser.SingleOrDefault(m => m.Email == HttpContext.User.Identity.Name);
            IList <Club>         clubList        = new List <Club>();
            LandingPageViewModel landingPageView = new LandingPageViewModel();

            if (applicationUser != null)
            {
                landingPageView = new LandingPageViewModel {
                    FirstName = applicationUser.FirstName, LastName = applicationUser.LastName, Applications = new List <ClubApplication>()
                };
            }

            foreach (Club club in _context.Clubs)
            {
                if (club.Owner != null && club.Owner == applicationUser)
                {
                    clubList.Add(club);
                }
            }

            foreach (ClubApplication clubAppl in _context.ClubApplications)
            {
                foreach (Club C in clubList)
                {
                    if (clubAppl.ClubId == C.Id && clubAppl.Status == ApplicationStatus.Pending)
                    {
                        landingPageView.Applications.Add(clubAppl);
                    }
                }
            }
            return(View(landingPageView));
        }
コード例 #3
0
        public ActionResult Index(LandingPageViewModel landingPageViewModel)
        {
            var arrivalStation = _webService.GetStation(landingPageViewModel.ArrivalStation);

            //_webService.GetStation(landingPageViewModel.DepartureStation);
            return(RedirectToAction("Test", arrivalStation));
        }
コード例 #4
0
        // GET: LandingPage
        public ActionResult Display(int documentId)
        {
            // Retrieves the page from the Kentico database
            TreeNode page = DocumentHelper.GetDocuments()
                            .WhereEquals("DocumentID", documentId)
                            .OnCurrentSite()
                            .TopN(1)
                            .FirstOrDefault();

            // Returns a 404 error when the retrieving is unsuccessful
            if (page == null)
            {
                return(HttpNotFound());
            }

            // Initializes the page builder with the DocumentID of the page
            HttpContext.Kentico().PageBuilder().Initialize(page.DocumentID);

            LandingPageProperties properties = GetProperties();

            var model = new LandingPageViewModel()
            {
                ShowTitle    = properties.ShowTitle,
                DocumentName = page.DocumentName
            };

            // Returns a TemplateResult object, created with an identifier of the page as its parameter
            // Automatically initializes the page builder feature for any editable areas placed within templates
            return(PartialView("PageTemplates/_LandingPageTemplate", model));
        }
コード例 #5
0
        public async Task <IActionResult> Index()
        {
            var settings = _settingservice.GetSettings();
            var model    = new LandingPageViewModel();

            if (settings.ShowTotalArticleCountOnFrontPage)
            {
                //model.TotalArticleCountMessage = string.Format(Resources.UIResources.PublicTotalArticleCountMessage, ArticleRepository.GetTotalArticleCount());
                model.TotalArticleCountMessage = string.Format("PublicTotalArticleCountMessage", _articleRepository.GetTotalArticleCount());
            }
            else
            {
                //kada je null - tokom dev
                ViewBag.ShowTotalArticleCountOnFrontPage = false;
            }


            model.HotCategories        = _categoryRepository.GetHotCategories().ToList();
            ViewBag.Title              = settings.CompanyName;
            model.FirstLevelCategories = _categoryRepository.GetFirstLevelCategories().ToList();
            model.LatestArticles       = _articleRepository.GetLatestArticles(settings.ArticleCountPerCategoryOnHomePage);
            model.PopularArticles      = _articleRepository.GetPopularArticles(settings.ArticleCountPerCategoryOnHomePage);
            //model.PopularTags = await _tagRepository.GetTagCloud().Select(tag => new TagCloudItem(tag)).ToListAsync();
            var pt = await _tagRepository.GetTagCloud();

            model.PopularTags = pt.Select(tag => new TagCloudItem(tag)).ToList();
            return(View(model));
        }
コード例 #6
0
        public LandingPageModule(ISettingsService <PlexRequestSettings> settingsService, ISettingsService <LandingPageSettings> landing,
                                 ISettingsService <PlexSettings> ps, IPlexApi pApi, IResourceLinker linker, ISecurityExtensions security) : base("landing", settingsService, security)
        {
            LandingSettings = landing;
            PlexSettings    = ps;
            PlexApi         = pApi;
            Linker          = linker;

            Get["LandingPageIndex", "/", true] = async(x, ct) =>
            {
                var s = await LandingSettings.GetSettingsAsync();

                if (!s.BeforeLogin && string.IsNullOrEmpty(Username)) //We are signed in
                {
                    var url = Linker.BuildRelativeUri(Context, "SearchIndex").ToString();
                    return(Response.AsRedirect(url));
                }

                var model = new LandingPageViewModel
                {
                    Enabled           = s.Enabled,
                    Id                = s.Id,
                    EnabledNoticeTime = s.EnabledNoticeTime,
                    NoticeEnable      = s.NoticeEnable,
                    NoticeEnd         = s.NoticeEnd,
                    NoticeMessage     = s.NoticeMessage,
                    NoticeStart       = s.NoticeStart,
                    ContinueUrl       = s.BeforeLogin ? $"userlogin" : $"search"
                };
                return(View["Landing/Index", model]);
            };
            Get["/status", true] = async(x, ct) => await CheckStatus();
        }
コード例 #7
0
ファイル: AccountController.cs プロジェクト: tclay8/Kanopy
        public async Task <ActionResult> Login(LandingPageViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            // This doesn't count login failures towards account lockout
            // To enable password failures to trigger account lockout, change to shouldLockout: true
            var result = await SignInManager.PasswordSignInAsync(model.Login.Email, model.Login.Password, model.Login.RememberMe, shouldLockout : false);

            switch (result)
            {
            case SignInStatus.Success:
                return(RedirectToLocal(returnUrl));

            case SignInStatus.LockedOut:
                return(View("Lockout"));

            case SignInStatus.RequiresVerification:
                return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.Login.RememberMe }));

            case SignInStatus.Failure:
            default:
                ModelState.AddModelError("", "Invalid login attempt.");
                return(View(model));
            }
        }
コード例 #8
0
ファイル: LandingPage.xaml.cs プロジェクト: damyantjain/TMS
 /// <summary>
 /// Initializes a new instance of the <see cref="LandingPage" /> class.
 /// </summary>
 public LandingPage()
 {
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
     NavigationPage.SetHasBackButton(this, false);
     landingPageViewModel = App.ViewModelLocator.LandingPageViewModel;
     BindingContext       = landingPageViewModel;
 }
コード例 #9
0
        public LandingPage()
        {
            InitializeComponent();
            BindingContext = new LandingPageViewModel(Navigation);

            //Remove the navigation bar from NavigationPage
            NavigationPage.SetHasNavigationBar(this, false);
        }
コード例 #10
0
        public ActionResult Index()
        {
            var vm = new LandingPageViewModel();

            vm.FeaturedArticles = db.Posts.Where(x => x.FrontPageFeature == true).ToList();

            return(View(vm));
        }
コード例 #11
0
        protected override async Task OnInitializedAsync()
        {
            await base.OnInitializedAsync();

            var settings = await GetSettings;

            ViewModel           = State.CurrentViewModel as LandingPageViewModel;
            ViewModel.HeroImage = $"{settings.ApiBaseUrl}{ViewModel.HeroImage}";
        }
コード例 #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TransactionHistoryPage"/> class.
 /// </summary>
 public TransactionHistoryPage()
 {
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
     NavigationPage.SetHasBackButton(this, false);
     landingPageViewModel     = SimpleIoc.Default.GetInstance <LandingPageViewModel>();
     BindingContext           = landingPageViewModel;
     NamePicker.SelectedValue = "All";
 }
コード例 #13
0
        public LandingPage()
        {
            InitializeComponent();
            this.DataContext = viewModel = new LandingPageViewModel();

            this.Loaded              += LandingPage_Loaded;
            this.Closing             += LandingPage_Closing;
            slider1.MouseDoubleClick += new MouseButtonEventHandler(RestoreScalingFactor);
        }
コード例 #14
0
        public async Task <IActionResult> Index()
        {
            LandingPageViewModel bannerContent = new LandingPageViewModel()
            {
                Itinerary = await _db.Itinerary.ToListAsync(),
                Admin     = await _db.Admin.ToListAsync(),
            };

            return(View(bannerContent));
        }
コード例 #15
0
 protected override void OnParentSet()
 {
     base.OnParentSet();
     if (Parent is CarouselViewControl carouselViewControl)
     {
         _viewModel = carouselViewControl.BindingContext as LandingPageViewModel;
         carouselViewControl.PositionSelected += CarouselViewControlOnPositionSelected;
         carouselViewControl.Scrolled         += CarouselViewControlOnScrolled;
     }
 }
コード例 #16
0
        public LandingPage()
        {
            InitializeComponent();
            BindingContext = _vm = new LandingPageViewModel(Navigation);

            //get exact name of this present file as a page
            var x = (this.GetType().Name);

            //logic here
            BusinessLogic.LogFrequentPage(x, PageAliasConstant.InvestmentPage, ImageConstants.InvestmentIcon);
        }
コード例 #17
0
        public ActionResult Login(string returnUrl)
        {
            ViewBag.ReturnUrl = returnUrl;
            var viewModel = new LandingPageViewModel
            {
                loginModel    = new LoginViewModel(),
                registerModel = new RegisterViewModel()
            };

            return(View(viewModel));
        }
コード例 #18
0
        /// <summary>
        /// Builds a category view model or retrieves it if it already exists
        /// </summary>
        /// <param name="productSearchOptions">The product options class for finding child products</param>
        /// <param name="categorySearchOptions">The category options classf or finding child categories</param>
        /// <param name="sortFields">The fields to sort he results on</param>
        /// <param name="item">The item.</param>
        /// <param name="rendering">The rendering to initialize the model with</param>
        /// <returns>
        /// A category view model
        /// </returns>
        protected virtual LandingPageViewModel GetLandingPageViewModel(CommerceSearchOptions productSearchOptions, CommerceSearchOptions categorySearchOptions, IEnumerable <CommerceQuerySort> sortFields, Item item, Rendering rendering)
        {
            if (this.CurrentSiteContext.Items[CurrentCategoryViewModelKeyName] == null)
            {
                var categoryViewModel = new LandingPageViewModel(item);
                this.CurrentSiteContext.Items[CurrentCategoryViewModelKeyName] = categoryViewModel;
            }

            var viewModel = (LandingPageViewModel)this.CurrentSiteContext.Items[CurrentCategoryViewModelKeyName];

            return(viewModel);
        }
コード例 #19
0
        public LoginViewModel(INavigator navigator, LoginManager loginManager, DomainManager DomainManager, LandingPageViewModel lPVM)
        {
//            #if DEBUG
//            EmailAdress = "karim";
//            Password = "******";
//            #endif
            LPVM = lPVM;
            Navigator = navigator;
            LoginManager = loginManager;
            this.DomainManager = DomainManager;
            InitializeFromCache();
        }
コード例 #20
0
 public ActionResult Index()
 {
     using (var articleContext = new ArticleContext())
     {
         var viewModel = new LandingPageViewModel
         {
             TopArticles   = articleContext.GetTopArticles(),
             OtherArticles = articleContext.GetOtherArticles()
         };
         return(View(viewModel));
     }
 }
コード例 #21
0
        //public IActionResult Index()
        //{

        //    return View();
        //}

        //Reciving Category Id, Optional
        public async Task <IActionResult> Index(int?Id)
        {
            //Setting the Count Value in the shopping cart session varable on the on the home page.
            // Getting the user Identiy  to know its User Id
            var claimsIdentity = (ClaimsIdentity)this.User.Identity;
            var claim          = claimsIdentity.FindFirst(ClaimTypes.NameIdentifier);

            if (claim != null)
            {
                var cnt = _context.shoppingCart.Where(u => u.AppliUserId == claim.Value).ToList().Count;
                HttpContext.Session.SetInt32(SC.sSsCartCount, cnt);
            }


            LandingPageViewModel vm   = new LandingPageViewModel();
            MenuItem             menu = new MenuItem();

            //Id is received when a specific Category is selected.Its the category Id
            if (Id != null)
            {// Checking first if the Id is a genuian
                var menuItems = await _context.MenuItem.Include(s => s.SubCategory).Include(c => c.Category).Where(c => c.CategoryId == Id).ToListAsync();

                if (menuItems == null)
                {
                    return(NotFound());
                }
                else// If a specific category has been selected
                {
                    vm.Category = await _context.Categories.ToListAsync();

                    //Will display coupons/offers which currently active, adminstrator will the oppertunity to activate/deactivate coupns
                    vm.Coupon = await _context.Coupon.Where(a => a.IsActive == true).ToListAsync();

                    vm.MenuItem = menuItems;
                    return(View(vm));
                }
            }
            else// If No Id has been received(no specifi slection), all menuitems are deiplayed
            {
                //Retrieving list of only those copons which are active.
                vm.Category = await _context.Categories.ToListAsync();

                vm.Coupon = await _context.Coupon.Where(a => a.IsActive == true).ToListAsync();

                //Note use the include where there is a relationship involove.
                vm.MenuItem = await _context.MenuItem.Include(c => c.Category).Include(s => s.SubCategory).ToListAsync();
            }



            return(View(vm));
        }
コード例 #22
0
ファイル: MainPage.xaml.cs プロジェクト: NeethuVinodan/CarMax
 public MainPage()
 {
     InitializeComponent();
     BindingContext = new LandingPageViewModel();
     try
     {
         Detail = new NavigationPage((Page)Activator.CreateInstance(typeof(HomePage)));
     }
     catch (Exception ex)
     {
     }
     IsPresented = false;
 }
コード例 #23
0
        public ActionResult Index()
        {
            var model = new LandingPageViewModel();

            model.StoreName  = configurationProvider[ConfigurationKeys.StoreName];
            model.ServerInfo = new Dictionary <string, string>();

            model.ServerInfo.Add("Database Server", configurationProvider.ServerName);
            model.ServerInfo.Add("Database Name", configurationProvider.DatabaseName);
            model.ServerInfo.Add("Application Server", Request.ServerVariables["SERVER_NAME"]);
            model.ServerInfo.Add("Browser", Request.Browser.Browser + " " + Request.Browser.Version);

            return(View(model));
        }
コード例 #24
0
ファイル: SubmittalController.cs プロジェクト: hdpham77/Test
        public ActionResult SubmittalFinished(int organizationId, int CERSID, int FSID)
        {
            Facility facility = Repository.Facilities.GetByID(CERSID);
            var      submittedSubmittalElements = Repository.FacilitySubmittalElements.Search(facilitySubmittalID: FSID).ToList();

            // queue up submittal deltas for submitted FSE's
            Services.SubmittalDelta.QueueDeltaFSEs(submittedSubmittalElements);

            LandingPageViewModel viewModel = new LandingPageViewModel()
            {
                Facility                  = facility,
                Instructions              = BuildSubmittalLandingText(submittedSubmittalElements, showPrintButton: (submittedSubmittalElements.Count == 0 ? false : true)),
                GuidanceMessages          = new List <GuidanceMessage>(),
                FacilitySubmittalElement  = submittedSubmittalElements.FirstOrDefault(),
                FacilitySubmittalElements = submittedSubmittalElements.ToList()
            };

            //Build Whats Next list items.
            List <WhatsNextItem> whatsNextItems = new List <WhatsNextItem>();

            // Get Route Values for the 'Submittal Summary'
            RouteValueDictionary routeValues = new RouteValueDictionary
            {
                { "organizationId", organizationId },
                { "CERSID", CERSID }
            };

            // Get Route Name for the 'Submittal Summary'
            string submittalSummaryRouteName = GetRouteName(OrganizationFacility.Home);

            whatsNextItems.Add(new WhatsNextItem(1, "Return to the {0} page.", "Draft Submittal", submittalSummaryRouteName, routeValues));

            submittalSummaryRouteName = CommonRoute.OrganizationHome.ToString();
            routeValues = new RouteValueDictionary()
            {
                { "id", organizationId }
            };
            whatsNextItems.Add(new WhatsNextItem(1, "Return to {0}.", "Facility Home", submittalSummaryRouteName, routeValues));

            viewModel.WhatsNext = whatsNextItems;

            //added 8/9/2013: Check to see whether this person was responded to the survey
            viewModel.Survey = Repository.Infrastructure.Surveys.Get("BizUserSurveyAugust2013");
            if (viewModel.Survey != null)
            {
                viewModel.PreviouslyRespondedToSurvey = Repository.Infrastructure.SurveyResponses.HasResponded(CurrentAccount, viewModel.Survey);
            }

            return(View(viewModel));
        }
コード例 #25
0
        public static LandingPageViewModel ToLandingPageViewModel(this DbSet <Signup> signupTable, Event currentEvent)
        {
            var newModel = new LandingPageViewModel
            {
                Name          = currentEvent.Name,
                Signups       = signupTable.ToList(),
                StartDateTime = currentEvent.StartDateTime,
                EndDateTime   = currentEvent.EndDateTime,
                MaxSignups    = currentEvent.MaxSignups,
                Price         = currentEvent.Price
            };

            return(newModel);
        }
コード例 #26
0
        public async Task <ActionResult> Register(LandingPageViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.registerModel.Name, Email = model.registerModel.Email
                };


                try
                {
                    var result = await UserManager.CreateAsync(user, model.registerModel.Password);

                    if (result.Succeeded)
                    {
                        await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                        // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                        // Send an email with this link
                        string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);

                        var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                        await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                        return(RedirectToAction("Index", "Home"));
                    }
                    AddErrors(result);
                }
                catch (DbEntityValidationException e)
                {
                    foreach (var eve in e.EntityValidationErrors)
                    {
                        System.Diagnostics.Debug.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                                           eve.Entry.Entity.GetType().Name, eve.Entry.State);
                        foreach (var ve in eve.ValidationErrors)
                        {
                            System.Diagnostics.Debug.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                                               ve.PropertyName, ve.ErrorMessage);
                        }
                    }

                    throw;
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
コード例 #27
0
        public async Task <IActionResult> Index(int?pageNumber, string searchString)
        {
            var games         = gameRepository.Search(searchString);
            var memories      = memorieRepository.GetAllMemories();
            int pageSize      = 6;
            var paginatedList = await PaginatedList <Game> .CreateAsync(games, pageNumber ?? 1, pageSize);

            var model = new LandingPageViewModel()
            {
                GameList       = games,
                GetAllMemories = memories,
                PaginatedList  = paginatedList
            };

            return(View(model));
        }
コード例 #28
0
        // add a GET to alter the ordering
        public ActionResult LandingPage(int?page, string sort)
        {
            var             user           = db.Users.Find(User.Identity.GetUserId());
            List <Question> usersQuestions = new List <Question>();
            List <Question> allQuestions   = new List <Question>();

            if (user != null)
            {
                usersQuestions = businessLogic.AllUserQuestions(user.Id);
                allQuestions   = businessLogic.GetQuestionsThatArentUsers(user.Id);
            }
            else
            {
                allQuestions = businessLogic.AllQuestions();
            }
            int    viewPage = page == null ? 1 : (int)page;
            string Sort     = sort == null ? "new" : sort;

            if (Sort == "Popular")
            {
                allQuestions = allQuestions.OrderByDescending(q => q.Answers.Count + q.Comments.Count).ToList();
            }
            else if (Sort == "OfDay")
            {
                var today = DateTime.Today;

                allQuestions = allQuestions.OrderByDescending(
                    q => q.Answers.Where(a => a.DatePosted.Value.Date == today).ToList().Count +
                    q.Comments.Where(c => c.DatePosted.Value.Date == today).ToList().Count).ToList();
            }
            else
            {
                allQuestions = allQuestions.OrderByDescending(q => q.DatePosted.Value).ToList();
            }
            ViewBag.AllQNum = allQuestions.Count;
            LandingPageViewModel viewModel = new LandingPageViewModel
            {
                CurrentUser          = user,
                AllQuestions         = allQuestions.Skip((viewPage - 1) * 10).Take(10).ToList(),
                CurrentUserQuestions = usersQuestions,
                Page       = viewPage,
                sortMethod = Sort,
            };

            return(View(viewModel));
        }
コード例 #29
0
        public async Task <IActionResult> AddReminder(LandingPageViewModel viewModel)
        {
            if (!string.IsNullOrEmpty(viewModel.Email))
            {
                var currentCultureName = _userContextProvider.GetCurrentCulture()?.Name;
                var currentLanguageId  = await _languageService
                                         .GetLanguageIdAsync(currentCultureName);

                await _emailReminderService
                .AddEmailReminderAsync(viewModel.Email,
                                       viewModel.SignUpSource,
                                       currentLanguageId);

                ShowAlertInfo(_sharedLocalizer[Annotations.Info.LetYouKnowWhen], "envelope");
            }
            return(RedirectToAction(nameof(Index)));
        }
コード例 #30
0
        public ActionResult Details(string slug)
        {
            if (slug == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Blog blogPost = db.Blogs.FirstOrDefault(b => b.Slug == slug);

            if (blogPost == null)
            {
                return(HttpNotFound());
            }

            //I am writing a LINQ statement that gets all published Blogs that aren't the main blogPost
            //thats why I have the && b.Id != blogPost.Id
            //This list of Other Blogs is used as my source...
            var randomBlogSource = db.Blogs.AsNoTracking().Where(b => b.Published && b.Id != blogPost.Id).ToList();

            var model = new LandingPageViewModel();

            model.Blog = blogPost;

            //This is how I create Random numbers in C#, I create a variable of type Random and then call the Next() method.
            //The arguments for Next() are the lower bound inclusive and an upper bound exclusive (i.e. rand.Next(0, 10)) will
            //ghenerate and return a number between 0 and 9
            var rand                  = new Random();
            var randIndex             = -1;
            var randomBlogSourceCount = -1;

            //This For Loop is here because I want to make 3 random selections out of the otherblogs list so that I can show them on the bottom of the Details view
            for (var loop = 0; loop <= 2; loop++)
            {
                //Here I am determining the upper bound for the Next method which is why I am calling the Count method
                randomBlogSourceCount = randomBlogSource.Count;

                //randIndex is an integer between 0 and otherblogs.Count - 1
                randIndex = rand.Next(0, randomBlogSourceCount);

                //I am adding to the OtherBlogs property of the LandingPageViewModel random Blogs from the Source
                model.OtherBlogs.Add(randomBlogSource[randIndex]);

                //Then I remove the Blog I found from the Source so it isn't chosen again
                randomBlogSource.RemoveAt(randIndex);
            }
            return(View(model));
        }
コード例 #31
0
        public ActionResult Index()
        {
            var settings = SettingsService.GetSettings();
            var model    = new LandingPageViewModel();

            if (settings.ShowTotalArticleCountOnFrontPage)
            {
                model.TotalArticleCountMessage = string.Format(UIResources.PublicTotalArticleCountMessage, ArticleRepository.GetTotalArticleCount());
            }

            model.HotCategories        = CategoryRepository.GetHotCategories().ToList();
            ViewBag.Title              = settings.CompanyName;
            model.FirstLevelCategories = CategoryRepository.GetFirstLevelCategories().ToList();
            model.LatestArticles       = ArticleRepository.GetLatestArticles(settings.ArticleCountPerCategoryOnHomePage);
            model.PopularArticles      = ArticleRepository.GetPopularArticles(settings.ArticleCountPerCategoryOnHomePage);
            model.PopularTags          = TagRepository.GetTagCloud().Select(tag => new TagCloudItem(tag)).ToList();
            return(View(model));
        }
コード例 #32
0
 public LandingPage(LandingPageViewModel landingPageViewModel)
 {
     InitializeComponent();
     LandingPageViewModel = landingPageViewModel;
     BindingContext = LandingPageViewModel;
 }
コード例 #33
0
        /// <summary>
        /// Builds a category view model or retrieves it if it already exists
        /// </summary>
        /// <param name="productSearchOptions">The product options class for finding child products</param>
        /// <param name="categorySearchOptions">The category options classf or finding child categories</param>
        /// <param name="sortFields">The fields to sort he results on</param>
        /// <param name="item">The item.</param>
        /// <param name="rendering">The rendering to initialize the model with</param>
        /// <returns>
        /// A category view model
        /// </returns>
        protected virtual LandingPageViewModel GetLandingPageViewModel(CommerceSearchOptions productSearchOptions, CommerceSearchOptions categorySearchOptions, IEnumerable<CommerceQuerySort> sortFields, Item item, Rendering rendering)
        {
            if (this.CurrentSiteContext.Items[CurrentCategoryViewModelKeyName] == null)
            {
                var categoryViewModel = new LandingPageViewModel(item);
                this.CurrentSiteContext.Items[CurrentCategoryViewModelKeyName] = categoryViewModel;
            }

            var viewModel = (LandingPageViewModel)this.CurrentSiteContext.Items[CurrentCategoryViewModelKeyName];
            return viewModel;
        }