public IActionResult Trending(Category category) { var trendsByFunds = _projectService.GetTrendsByFunds().ToList(); var trendsByFunders = _projectService.GetTrendsByFunders().ToList(); var trendsByCategory = _projectService.GetTrendsByCategory(category).ToList(); if (trendsByFunds == null) { return(null); } if (trendsByFunders == null) { return(null); } trendsByFunds.ForEach(p => p.Description = ExtraMethod.ConvertToRawHtml(p.Description)); trendsByFunders.ForEach(p => p.Description = ExtraMethod.ConvertToRawHtml(p.Description)); trendsByCategory.ForEach(p => p.Description = ExtraMethod.ConvertToRawHtml(p.Description)); var TrendingsViewModel = new TrendingViewModel() { GetTrendsByFunders = trendsByFunders, GetTrendsByFunds = trendsByFunds, GetTrendsByCategory = trendsByCategory }; return(View(TrendingsViewModel)); }
public IActionResult Index() { Author author = this._unitOfWork.Authors.TheTopSellingArtist(); Auction auction = this._unitOfWork.Auctions.GetTheHottestAuction(); TrendingViewModel vm = new TrendingViewModel { Author = author, Auction = auction }; return(View(vm)); }
public IActionResult Trending() { var service = new BookService(HttpContext.Session.GetString("Token")); var trending = service.TrendingBooks(); service = new BookService(HttpContext.Session.GetString("Token")); var newest = service.NewestBooks(); var trendingModel = new TrendingViewModel { NewestBooks = newest, TrendingBooks = trending }; return(View(trendingModel)); }
public override void ViewDidLoad() { base.ViewDidLoad(); var na = Locator.Current.GetService <INetworkActivityService>(); var a = Locator.Current.GetService <IApplicationService>(); var feat = Locator.Current.GetService <IFeaturesService>(); var profileViewModel = new ProfileViewModel(a, na, feat); var profileViewController = new ProfileViewController { ViewModel = profileViewModel }; profileViewController.ViewModel.GoToInterestsCommand.Subscribe(_ => SelectedIndex = 1); profileViewController.TabBarItem = new UITabBarItem("Profile", Images.User, Images.UserFilled); profileViewController.ViewModel.View = profileViewController; var interestsViewModel = new InterestsViewModel(a, feat); var interestsViewController = new InterestsViewController { ViewModel = interestsViewModel }; interestsViewController.TabBarItem = new UITabBarItem("Interests", Images.Heart, Images.HeartFilled); interestsViewController.ViewModel.View = interestsViewController; var trendingViewModel = new TrendingViewModel(na, new RepositoryStumble.Core.Data.TrendingRepository()); var trendingViewController = new TrendingViewController(); trendingViewController.ViewModel = trendingViewModel; trendingViewController.TabBarItem = new UITabBarItem("Trending", Images.Trending, Images.TrendingFilled); trendingViewController.ViewModel.View = trendingViewController; var vm = new ShowcasesViewModel(Locator.Current.GetService <INetworkActivityService>(), new RepositoryStumble.Core.Data.ShowcaseRepository()); var showcasesViewController = new ShowcasesViewController { ViewModel = vm }; showcasesViewController.TabBarItem = new UITabBarItem("Showcase", Images.Spotlight, Images.Spotlight); showcasesViewController.ViewModel.View = showcasesViewController; var stumble = new UIViewController(); stumble.TabBarItem = new UITabBarItem("Stumble!", Images.Search, Images.Search); this.ViewControllers = new[] { new UINavigationController(profileViewController), new UINavigationController(interestsViewController), stumble, new UINavigationController(trendingViewController), new UINavigationController(showcasesViewController) }; nfloat width = 60; if (TabBar.Subviews.Length == 5) { width = TabBar.Subviews[2].Bounds.Width; } var stumbleView = new StumbleView(new CGRect(TabBar.Bounds.Width / 2f - width / 2, 0, width, TabBar.Bounds.Height), UITabBar.Appearance.TintColor); stumbleView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; stumbleView.UserInteractionEnabled = false; TabBar.Add(stumbleView); nint previousSelectedIndex = 0; ViewControllerSelected += (sender, e) => { if (e.ViewController == stumble) { if (Locator.Current.GetService <IApplicationService>().Account.Interests.Count() == 0) { SelectedIndex = 1; Locator.Current.GetService <IAlertDialogService>().Alert( "You need some interests!", "Please add at least one interest before you stumble!"); } else { ViewModel.GoToStumbleCommand.ExecuteIfCan(); SelectedIndex = previousSelectedIndex; } } else { previousSelectedIndex = SelectedIndex; } }; }
public TrendingPage() { InitializeComponent(); BindingContext = this.viewModel = new TrendingViewModel(); }