public ActionResult Index() { IEnumerable<CityViewModel> cities = this.Cache.Get( "cities", () => this.CitiesService.GetMostPopular() .To<CityViewModel>() .ToList(), 15 * 60); IEnumerable<UserViewModel> users = this.UsersService.GetMostPopularAgents() .To<UserViewModel>().ToList(); IEnumerable<RealEstateViewModel> realEstates = this.RealEstatesService.GetMostRecent() .To<RealEstateViewModel>().ToList(); HomePageViewModel vm = new HomePageViewModel() { Cities = cities, Users = users, RealEstates = realEstates }; return this.View(vm); }
public ActionResult Index() { var snippets = this.Data.Snippets .All() .Include(x => x.Labels) .OrderByDescending(x => x.CreationTime) .Take(GlobalConstants.HomePageNumber); var comments = this.Data.Comments.All() .OrderByDescending(x => x.CreationTime) .Take(GlobalConstants.HomePageNumber); var labels = Data.Labels .All() .OrderByDescending(l => l.Snippets.Count) .Take(GlobalConstants.HomePageNumber); var model = new HomePageViewModel() { Snippets = Mapper.Map<IEnumerable<SnippetViewModel>>(snippets), Comments = Mapper.Map<IEnumerable<CommentViewModel>>(comments), Labels = Mapper.Map<IEnumerable<HomePageLabelViewModel>>(labels) }; return View(model); }
/// <summary> /// Displays the Index page for Veil. /// </summary> /// <returns>The Index view with the processed HomePageViewModel.</returns> public async Task<ActionResult> Index() { IQueryable<Game> comingSoon = db.Games. Where( g => g.GameSKUs.Any() && g.GameSKUs.Min(gp => gp.ReleaseDate) > DateTime.Now); IQueryable<Game> newReleases = db.Games. Where( g => g.GameSKUs.Any() && g.GameSKUs.Max(gp => gp.ReleaseDate) <= DateTime.Now); newReleases = FilterOutInternalOnly(newReleases).OrderBy(g => g.Name); comingSoon = FilterOutInternalOnly(comingSoon).OrderBy(g => g.Name); var model = new HomePageViewModel { ComingSoon = await comingSoon. OrderByDescending(g => g.GameSKUs.Min(gp => gp.ReleaseDate)). Take(COMING_SOON_COUNT). ToListAsync(), NewReleases = await newReleases. OrderByDescending(g => g.GameSKUs.Min(gp => gp.ReleaseDate)). Take(NEW_RELEASE_COUNT). ToListAsync() }; return View(model); }
public ActionResult DisplayPage(Pager pager) { if (pager == null || !this.ModelState.IsValid) { return this.HttpNotFound("The specified page has disappeared without a trace"); } if (pager.TotalPages == 0) { pager.TotalPages = this.quizzes.GetTotalPages(pager.CategoryName, QuizzesPerPage); } var rankingPeriod = new WeeklyRange(); var maxSolutions = this.GetMaxSolutions(rankingPeriod); var models = this.Ranking.GetQuizzesOrderedBySolutions(rankingPeriod) .Where(q => q.Category.Name == pager.CategoryName) .ApplyPaging(pager) .To<QuizRankedBySolutions>() .ToArray(); var viewModel = new HomePageViewModel(maxSolutions, rankingPeriod, pager) { Quizzes = models, Categories = this.GetTopCategories(), }; return this.View(viewModel); }
public void HasFeaturedCampaignShouldReturnTrueIfViewMModelHasAFeaturedCampaign() { var sut = new HomePageViewModel() { FeaturedCampaign = new CampaignSummaryViewModel { Id = 1, Title = "Something" } }; Assert.True(sut.HasFeaturedCampaign); }
public ActionResult Index() { HomePageViewModel model = new HomePageViewModel(); int size = 15; List<Photo> HomepagePhotos = repository.GetHomePagePhotos(size); model.Photos = HomepagePhotos; return View(model); }
public ActionResult Index() { var activeSlides = this.slides.All().ToList(); var linkedSlides = new LinkedSlideList(activeSlides); var model = new HomePageViewModel { Slides = linkedSlides.Slides, }; return View(model); }
protected override void OnNavigatedTo(NavigationEventArgs e) { if (DataContext == null) { string selectedIndex = ""; if (NavigationContext.QueryString.TryGetValue("scorecardIndex", out selectedIndex)) { int index = int.Parse(selectedIndex); DataContext = HomePageViewModel.get_instance().scorecards[index]; scorecardViewModel = HomePageViewModel.get_instance().scorecards[index]; } } }
public IActionResult Index() { //var model = new Restaurants() { Id = 1, Name = "The House of Kobe" }; //var model = _restaurantData.GetAll(); var model = new HomePageViewModel(); model.Restaurants = _restaurantData.GetAll(); model.CurrentMessage = _greeter.GetGreeting(); return(View(model)); //return Content("Hello, from the HomeController"); }
public IActionResult Index() { var returnViewModel = new HomePageViewModel() { CardsOfTheMonthViewModel = new CardsOfTheMonthViewModel { CardsOfTheMonths = _repositoryCardsOfTheMonth.CardsOfTheMonths() }, ContactFormViewModel = new ContactFormViewModel { } }; return(View(returnViewModel)); }
// GET: /<controller>/ public IActionResult Index(string query = null) { var model = new HomePageViewModel { FileInfos = string.IsNullOrWhiteSpace(query) ? _fileData.GetAll(GetNonAdminUserCompanyId()) : _fileData.Search(query), Message = _greeter.GetGreeting(), Query = query }; return(View(model)); }
public HomePageViewModel GetViewModel(HomePage content) { var viewModel = new HomePageViewModel() { Carousel = GetCarouselViewModel(content), CalloutCards = _calloutCardsService.GetCalloutCards(content.CalloutCards), ResourcesTitle = content.ResourcesTitle, ResourcesItems = GetResourcesItems(content), LatestNewsSection = _latestNewsSectionService.GetViewModel(content) }; return(viewModel); }
public ActionResult Index() { HomePageViewModel viewModel = new HomePageViewModel { User = db.GetByEmail(User.Identity.Name) }; if (TempData["message"] != null) { viewModel.Message = (string)TempData["message"]; } return(View(viewModel)); }
// GET: Home public ActionResult homepage() { DatabaseContext db = new DatabaseContext(); List <kisiler> kisiler_listesi = db.kisiler.ToList(); //select * from kisiler //aynı zamanda database olusumunu tetikler bu select islemi HomePageViewModel model = new HomePageViewModel(); model.kisiler = db.kisiler.ToList(); //database den liste şeklinde kişileri döner model.adresler = db.adresler.ToList(); //database den liste şeklinde adresleri döner return(View(model)); }
public ActionResult homepage(HomePageViewModel c) { DatabaseContext db = new DatabaseContext(); List <my_procedure_class> result = db.EXECUTE_my_procedure(c.alt_sinir, c.ust_sinir); HomePageViewModel md = new HomePageViewModel(); md.my_procedure_class_primitive_object = result.ToList(); ViewBag.control = false; // md.my_procedure_class_primitive_object = result.ToList(); return(View(md)); }
// // GET: /Default/ public ActionResult Index() { var products = _productService.GetProductsOnSale(); var vm = new HomePageViewModel(); vm.Products = new List <ViewModelProduct>(); foreach (var product in products) { vm.Products.Add(new ViewModelProduct(product.Id, product.Name)); } return(View(vm)); }
public ActionResult Index() { if (Request.IsAuthenticated) { string userId = User.Identity.GetUserId(); BPUser bpUser = _context.BPUsers.Where(s => s.AppId == userId).SingleOrDefault(); System.Web.HttpContext.Current.Session["UserName"] = bpUser.FirstName + " " + bpUser.LastName; } HomePageViewModel homePageViewModel = new HomePageViewModel(); return(View(homePageViewModel)); }
[AllowAnonymous] // 允许匿名用户访问 public ViewResult Index() { //var employee = new Employee { ID = 1, Name = "小白" }; //return View(employee); var model = new HomePageViewModel(); SQLEmployeeData sqlData = new SQLEmployeeData(_context); model.Employees = sqlData.GetAll(); return(View(model)); }
public IActionResult Index(string Searchstring) { var model = new HomePageViewModel(); model.Restaurants = _restaurantData.GetAll(); if (!String.IsNullOrEmpty(Searchstring)) { model.Restaurants = model.Restaurants.Where(s => s.Name.Contains(Searchstring)); } return(View(model)); }
public BaseViewModel() { HomePageVM = new HomePageViewModel(); ThreadPageVM = new ThreatPageViewModel(); QuickScanVM = new QuickScanViewModel(); CurrentView = HomePageVM; DisplayThreatPageCommand = new RelayCommand(o => { CurrentView = ThreadPageVM; }, o => true); DisplayHomePageCommand = new RelayCommand(o => { CurrentView = HomePageVM; }, o => true); DisplayQuickScanCommand = new RelayCommand(o => { CurrentView = QuickScanVM; }, o => true); }
public async Task <IActionResult> Index() { var viewmodel = new HomePageViewModel() { Announcements = await announcementrepo.GetAnnouncements(), LatestProducts = await productrepo.GetLatestProductsList(), RandomProducts = await productrepo.GetRandomProductsList(), RandomCategories = (await categoryrepo.GetCategoryList()).Take(6), Brands = await brandsrepo.GetBrandsList() }; return(View(viewmodel)); }
public NavBarViewModel(NavigationStateViewModel navigationState, RoutingState router, WalletManagerViewModel walletManager, AddWalletPageViewModel addWalletPage) { Router = router; _walletManager = walletManager; _topItems = new ObservableCollection <NavBarItemViewModel>(); _bottomItems = new ObservableCollection <NavBarItemViewModel>(); SelectedItem = new HomePageViewModel(navigationState, walletManager, addWalletPage); _topItems.Add(SelectedItem); _bottomItems.Add(addWalletPage); _bottomItems.Add(new SettingsPageViewModel(navigationState)); Router.CurrentViewModel .OfType <NavBarItemViewModel>() .Subscribe( x => { if (walletManager.Items.Contains(x) || _topItems.Contains(x) || _bottomItems.Contains(x)) { if (!_isNavigating) { _isNavigating = true; SelectedItem = x; _isNavigating = false; } } }); this.WhenAnyValue(x => x.SelectedItem) .OfType <NavBarItemViewModel>() .Subscribe( x => { if (!_isNavigating) { _isNavigating = true; x.NavigateToSelfAndReset(); CollapseOnClickAction?.Invoke(); _isNavigating = false; } }); Observable.FromEventPattern(Router.NavigationStack, nameof(Router.NavigationStack.CollectionChanged)) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(_ => IsBackButtonVisible = Router.NavigationStack.Count > 1); this.WhenAnyValue(x => x.IsOpen) .Subscribe(x => SelectedItem.IsExpanded = x); }
public ActionResult Index() { HttpResponseMessage response = null; SeasonDetails modelReturnJSON = null; HomePageViewModel homeMode = new HomePageViewModel(); try { homeMode.actionUser = "******"; response = GlobalVariables.WebApiClient.PostAsJsonAsync("Season", homeMode).Result; modelReturnJSON = response.Content.ReadAsAsync <SeasonDetails>().Result; switch (response.StatusCode) { case HttpStatusCode.Created: if (modelReturnJSON.returnMessage == "subscribeBenchSuccessfully") { Session["user.current.season.menu"] = null; Session["user.current.season.summary"] = null; homeMode.seasonID = modelReturnJSON.id; homeMode.seasonName = modelReturnJSON.name; ViewBag.inGentelella = "0"; return(View(homeMode)); } else { //ModelState.AddModelError("", "Senha Atual inválida! Favor tentar novamente."); TempData["returnMessage"] = "Ocorreu algum erro na exibição da Home Page do Arena. (" + modelReturnJSON.returnMessage + ")"; return(View(homeMode)); } default: TempData["returnMessage"] = "Ocorreu algum erro na exibição da Home Page do Arena. (" + response.StatusCode + ")"; ModelState.AddModelError("", "application error."); return(View(homeMode)); } } catch (Exception ex) { TempData["returnMessage"] = "Erro interno - Exibindo Home Page Arena: (" + ex.InnerException.Message + ")"; ModelState.AddModelError("", "application error."); return(View(homeMode)); } finally { response = null; modelReturnJSON = null; homeMode = null; } }
public async Task <IActionResult> Edit() { HomePageViewModel model = new HomePageViewModel(); await TryUpdateModelAsync(model); var currentUser = userService.CurrentUserSettings; HomePage modelObj = await unitOfWork.homePages.get(model.id).Include("announcements").FirstOrDefaultAsync(); if (modelObj == null) { modelObj = new HomePage(); modelObj.createDt = DateTime.UtcNow; modelObj.createUser = currentUser.userId; modelObj.lastUpdDt = DateTime.UtcNow; modelObj.lastUpdUser = currentUser.userId; unitOfWork.homePages.add(modelObj); } else { if (modelObj.createDt == null) { modelObj.createDt = DateTime.UtcNow; } if (modelObj.createUser == null) { modelObj.createUser = currentUser.userId; } modelObj.lastUpdDt = DateTime.UtcNow; modelObj.lastUpdUser = currentUser.userId; unitOfWork.homePages.update(modelObj); } acceptPost(modelObj, model); if (ModelState.ErrorCount == 0) { var success = await unitOfWork.tryUniqueConstraintCommitAsync(); if (success) { return(RedirectToAction("Index", "Home")); } ModelState.AddModelError("", "Unable to update data."); //Elmah error } var vm = setupViewModel(modelObj, FormViewMode.Edit); return(View(vm)); }
public HomePage() { InitializeComponent(); viewModel = new HomePageViewModel(); viewModel.LocationImagePath = "KtMobileApp.Assets.Images.locationWhite.png"; viewModel.WeatherImagePath = "KtMobileApp.Assets.Images.WeatherCloud.png"; viewModel.BackImagePath = "TajMahal.jpg"; viewModel.CurrentLocation = "AGRA"; viewModel.Country = "India"; BindingContext = viewModel; BindingContext = viewModel; }
public IActionResult ClientGetAntiqueById(int id) { Antique antique = _context.Antiques.Where(a => a.Id == id).SingleOrDefault(); HomePageViewModel model = new HomePageViewModel(); model.Id = antique.Id; model.Name = antique.Name; model.Description = antique.Description; model.BasePrice = antique.BasePrice; model.CurrentBid = antique.CurrentBid; model.BidEnd = antique.BidEndTime; model.PhotoPaths = _context.Photos.Where(p => p.AntiqueId == antique.Id).Select(p => p.Path).ToList(); return(Ok(model)); }
// GET: Home public ActionResult homepage() { var db = new DatabaseContext(); HomePageViewModel model = new HomePageViewModel(); model.Kisiler = db.Kisiler.ToList(); model.Adresler = db.Adresler.ToList(); return(View(model)); //List<Kisiler> kisiler = db.Kisiler.ToList(); //return View(kisiler); }
public HttpResponse Index() { if (this.IsUserLoggedIn()) { var model = new HomePageViewModel() { Products = this.productsService.GetProductsForHomePage() }; return(this.View(model, "Home")); } return(this.View("Index")); }
public ActionResult Index(string searchText) { var vm = new HomePageViewModel(); if (String.IsNullOrEmpty(searchText)) { return(View(vm)); } var scraper = new Scraper(); vm.Items = scraper.Search(searchText); vm.SearchText = searchText; return(View(vm)); }
public async Task<ActionResult> Index() { var model = new HomePageViewModel(); using (var repository = RepositoryFactory.GetInstance(Session)) { var worldRetriver = new WorldContentTypeRetriver(HttpContext, repository); await MyMentorUserManager.LoginWithAuthCookie(Session, HttpContext, repository); model.BannerName = worldRetriver.GetContentTypeName(); model.ContentWorlds = worldRetriver.GetWorldsByRole(Session.GetLoggedInUser(),Session.GetLoggedInUserRoleName()); return View("index", model); } }
public HomePage() { NavigationPage.SetHasNavigationBar(this, false); InitializeComponent(); viewModel = new HomePageViewModel(); Title = "Home"; viewModel.LocationImagePath = "KtMobileApp.Assets.Images.locationWhite.png"; viewModel.WeatherImagePath = "KtMobileApp.Assets.Images.WeatherCloud.png"; viewModel.BackImagePath = "TajMahal.jpg"; viewModel.CurrentLocation = "AGRA"; viewModel.Country = "India"; BindingContext = viewModel; }
public ActionResult Fakulte(HomePageViewModel model) { var i = db.poolFakulteBolum.FirstOrDefault(); model.Bolumleri = db.poolFakulteBolum.OrderBy(x => x.tblBolumler.Name).Where(x => x.FpoolokulfalulteID == model.FakulteId) .Select(x => new SelectListItem { Value = x.tblBolumler.Id.ToString(), Text = x.tblBolumler.Name }).ToList(); return(PartialView("FakulteBolumleriPartial", model)); }
public HomePage() { InitializeComponent(); var homePageViewModel = new HomePageViewModel(); BindingContext = homePageViewModel; webview.Navigated += (sender, e) => { if (e.Url != null) { homePageViewModel.IsBusy = false; } }; }
public ActionResult Index() { // Albums for image gallery (30 random albums) var albums = db.Albums.Include(a => a.Artist).Shuffle(new Random()).Take(30); HomePageViewModel vm = new HomePageViewModel() { PageTitle = "Welcome to my record collection!", PageSubTitle = "A mix of Punk rock, Punk rock and Punk rock", Albums = albums.ToList() }; return(View(vm)); }
// GET: Home /* public ActionResult Index() * { * var db = new WhereAUEntities(); * UniversityViewModel model = new UniversityViewModel(); * * * List<tblOkullar> okulList = db.tblOkullar.OrderBy(x => x.OkulName).ToList(); * List<poolOkulFakulte> okulunFakulteList = db.poolOkulFakulte.OrderBy(f => f.FFakulteID).ToList(); * // List<poolFakulteBolum> fakulteninBolumList = db.poolFakulteBolum.OrderBy(k => k.FBolumID).ToList(); * List<tblFakulteler> fakulteList = db.tblFakulteler.OrderBy(k => k.Id).ToList(); * * model.UniversiteList = (from s in okulList * select new SelectListItem * { * Text = s.OkulName, * Value = s.Id.ToString() * }).ToList(); * model.UniversiteList.Insert(0, new SelectListItem { Value = " ", Text = "Seçiniz", Selected = true }); * * * return View(model); * * } */ public ActionResult Anasayfa() { WhereAUEntities db = new WhereAUEntities(); var model = new HomePageViewModel(); model.Universiteler = db.tblOkullar.Select(x => new SelectListItem() { Text = x.OkulName, Value = x.Id.ToString() }).ToList(); return(View(model)); }
public async Task <IActionResult> Index() { if (!HttpContext.Session.Keys.Contains("UserSession")) { HttpContext.Session.Set("UserSession", System.Text.Encoding.UTF8.GetBytes("SessionCreation")); } HomePageViewModel hvm = new HomePageViewModel(); hvm.Brands = await _brandRepository.GetAllAsync(); hvm.Products = (await _productRepository.GetPopularProductsAsync(_maxProductCount)).ToList(); return(View(hvm)); }
public IActionResult Index(string SearchString) { HomePageViewModel model = new HomePageViewModel(); IEnumerable <Product> products = repo.Products.ToList(); if (!String.IsNullOrEmpty(SearchString)) { products = products.Where(s => s.Name.Contains(SearchString)).ToList(); } model.Products = products; model.Brands = repoBrand.Brands.ToList(); model.Categories = repoCategory.Categories.ToList(); return(View(model)); }
public IActionResult Index() { var mgr = new PersonManager(_connectionString); var vm = new HomePageViewModel { People = mgr.GetPeople(), }; if (TempData["success-message"] != null) { vm.Message = (string)TempData["success-message"]; } return(View(vm)); }
public ActionResult Index() { var tweets = this.data.Tweets .All() .OrderByDescending(t => t.CreationDate) .Select(TweetViewModel.FromTweet) .ToList(); var model = new HomePageViewModel() { Tweets = tweets, NewTweet = new SubmitTweetViewModel() }; return View(model); }
public ActionResult Index() { var topMatches = this.Data.Matches.All() .Include(m => m.HomeTeam) .Include(m => m.AwayTeam) .OrderByDescending(m => m.Bets.Count) .Take(3); var bestTeams = this.Data.Teams.All() .OrderByDescending(m => m.Votes.Count) .Take(3); var model = new HomePageViewModel() { TopMatches = Mapper.Map<IEnumerable<ConciseMatchViewModel>>(topMatches), BestTeams = Mapper.Map<IEnumerable<ConciseTeamViewModel>>(bestTeams) }; return this.View(model); }
public ActionResult Index() { var model = new HomePageViewModel { Games = this.Data.Games.All() .OrderByDescending(g => g.Ratings.Average(r => r.Value)) .ThenBy(g => g.Title) .Take(HomePageItemLimit) .Select(GameViewModel.Create) .ToList(), Reviews = this.Data.Reviews.All() .OrderByDescending(r => r.CreationTime) .Take(HomePageItemLimit) .Select(ReviewViewModel.Create) .ToList() }; return this.View(model); }
protected HomePageViewModel CreateHomePageViewModel(List<ContestBasicDetails> contests) { var model = new HomePageViewModel() { ContestBasicDetails = contests, CurrentUserId = this.CurrentUser == null ? null : this.CurrentUser.Id, }; return model; }
public void HasFeaturedCampaignShouldReturnFalseIfViewModelHasNoFeaturedCampaign() { var sut = new HomePageViewModel(); Assert.False(sut.HasFeaturedCampaign); }
// GET: Admin/Home public ActionResult Index() { var allWithDeleted = this.slides.AllWithDeleted().ToList(); var activeSlides = allWithDeleted.Where(s => !s.IsDeleted).ToList(); var deletedSlides = allWithDeleted.Where(s => s.IsDeleted).ToList(); var linkedSlides = new LinkedSlideList(activeSlides); var model = new HomePageViewModel() { Slides = linkedSlides.Slides, DeletedSlides = deletedSlides, }; return View(model); }