// GET: Users public async Task <IActionResult> Index(int?id) { var result = await userService.GetAllAsync(); var viewModel = new IndexPageViewModel(); return(View(viewModel.MapUsersToViewModel(id, result))); }
public async Task<IActionResult> IndexPartial() { var viewModel = new IndexPageViewModel { Products = await WebAPICalls.GetFeaturedProducts(), Categories = await WebAPICalls.GetCategories() }; return View(viewModel); }
public async Task <ActionResult> Index(int page = 1, string sort_type = "6") { int pageSize = 20; ViewBag.CurrentSort = sort_type; int storageId = await storageService.GetStorageIdByUserName(User.Identity.Name); var filesDto = await fileService.GetStorageFiles(storageId); var filesViewModel = mapper.Map <List <FileViewModel> >(filesDto); switch (sort_type) { case "1": filesViewModel = filesViewModel.OrderBy(x => x.Name).ToList(); break; case "2": filesViewModel = filesViewModel.OrderByDescending(x => x.Name).ToList(); break; case "3": filesViewModel = filesViewModel.OrderBy(x => x.Length).ToList(); break; case "4": filesViewModel = filesViewModel.OrderByDescending(x => x.Length).ToList(); break; case "5": filesViewModel = filesViewModel.OrderBy(x => x.CreationDate).ToList(); break; case "6": filesViewModel = filesViewModel.OrderByDescending(x => x.CreationDate).ToList(); break; default: filesViewModel = filesViewModel.OrderByDescending(x => x.CreationDate).ToList(); break; } var filesPerPages = filesViewModel.Skip((page - 1) * pageSize).Take(pageSize); var pageInfo = new PageInfo { PageNumber = page, PageSize = pageSize, TotalItems = filesViewModel.Count }; var resultModel = new IndexPageViewModel { PageInfo = pageInfo, Files = filesPerPages }; return(View(resultModel)); }
public void ShouldCallStationFinderGetOnce() { var _mockIndexViewPageModel = new Mock <IIndexPageViewModel>(); var _mockStationFinder = new Mock <IStationFinder>(); var _mockStationFinderResultPageModel = new Mock <IStationFinderResultPageViewModel>(); var _mockJourneyFinder = new Mock <IJourneyfinder>(); var _mockJourneyDetailsPageViewModel = new Mock <IJourneyDetailsPageViewModel>(); var _mockPreviousJourneyViewModel = new Mock <IPreviousJourneysViewModel>(); var sut = new HomeController(_mockIndexViewPageModel.Object, _mockStationFinder.Object, _mockStationFinderResultPageModel.Object, _mockJourneyFinder.Object, _mockJourneyDetailsPageViewModel.Object, _mockPreviousJourneyViewModel.Object); _mockStationFinder.Setup(x => x.Get(It.IsAny <Station>(), It.IsAny <Station>())).Returns( new List <StationFinderResponseModel>() { new StationFinderResponseModel() { Matches = new List <Station>() { new Station() { Name = "Station One" } } }, new StationFinderResponseModel() { Matches = new List <Station>() { new Station() { Name = "Station Two" } } } } ); var FakeIndexLandingPageModel = new IndexPageViewModel() { Arrival = new Station() { Name = "Kings" }, Departure = new Station() { Name = "Tott" } }; sut.Index(FakeIndexLandingPageModel); _mockStationFinder.Verify(x => x.Get(It.IsAny <Station>(), It.IsAny <Station>()), Times.Exactly(1)); }
public ActionResult Index() { var model = new IndexPageViewModel() { Stadiums = _stadiumRepo.GetAllStadiums() }; return(View(model)); }
public ActionResult Warehouses() { var model = new IndexPageViewModel() { Ware = ware.GetAllWarehouses().ToDictionary(x => x.Id) }; return(View(model)); }
public ActionResult WarehouseGuns(int Id) { var model = new IndexPageViewModel() { Gun = repo.SelectionByWarehouse(Id) }; return(View(model)); }
public ActionResult Index() { var sections = this.Data.Sections.All().ProjectTo <SectionViewModel>().ToList(); var viewModel = new IndexPageViewModel { Sections = sections }; return(this.View(viewModel)); }
public ActionResult Index() { var model = new IndexPageViewModel() { FeaturedCars = _carsRepo.GetAllFeaturedCars(), Specials = _specialsRepo.GetAll(), }; return(View(model)); }
// // GET: /Link1/ //public async System.Threading.Tasks.Task<ViewResult> Index() //{ // var myService = new SlowService(); // var result = await myService.GetString("this is the input string"); // return View(); //} public ActionResult Index() { ViewBag.lei = "feeling hot hot hot"; var model = new IndexPageViewModel() { Title = "this is a title", Text1 = "this is text1", Text2 = "this is text2" }; return(View(model)); }
public async Task <ActionResult> NarrowIndex(TagSortKind sort = TagSortKind.RefListCountDescending) { var tags = await _tagHandler.GetAllTagsAsync(sort); var vm = new IndexPageViewModel() { Tags = Mapper.Map <ICollection <TagViewModel> >(tags), }; return(JsonNet(vm, JsonRequestBehavior.AllowGet)); }
[OutputCache(Duration = 600)] /// 10分 public async Task <ActionResult> Index() { var tags = await _tagHandler.GetAllTagsAsync(TagSortKind.RefListCountDescending); var vm = new IndexPageViewModel() { Tags = Mapper.Map <ICollection <TagViewModel> >(tags), }; return(View(vm)); }
public ActionResult Index(ProjectCriteria projectCriteria) { IPagedList <Project> projects = _projectService.Search(projectCriteria); var searchView = new IndexPageViewModel { ProjectCriteria = projectCriteria, Projects = projects }; return(View(searchView)); }
public async Task <ActionResult> Index() { var users = await _UserHandler.GetAllUsersAsync(); var vm = new IndexPageViewModel() { Users = Mapper.Map <ICollection <UserViewModel> >(users), }; return(View(vm)); }
public IndexPageViewModel LoadIndexPage() { var model = new IndexPageViewModel() { Marketings = Marketings.ToList(), Carousels = Carousels.ToList(), Articles = Articles.ToList() }; return(model); }
public ActionResult Index() { var ggun = gunrepo.GetAllGuns(); var model = new IndexPageViewModel() { Guns = gunrepo.GetAllGuns().ToDictionary(x => x.Id), ReservedGuns = ggun.Where(p => resserv.GunIsOccupied(p)).Select(p => p.Id).ToList() }; return(View(model)); }
public ActionResult Index(int?page) { var pageNumber = page ?? 1; var users = this.Data.Users.All().Where(u => u.Status != Status.Deleted).ProjectTo <UserConciseViewModel>().ToList(); var viewModel = new IndexPageViewModel { Users = users }; var model = viewModel.Users.ToPagedList(pageNumber, UsersPerPageDefaultValue); return(this.View(model)); }
void load(Pivot element, PivotItem i = null) { PivotItem item = i is null ? element.SelectedItem as PivotItem : i; IndexPageViewModel model = item.Tag as IndexPageViewModel; ListView view = item.Content as ListView; ObservableCollection <Entity> feeds = view.ItemsSource as ObservableCollection <Entity>; string u = model.url; u = u.Replace("#", "%23"); u = "/page/dataList?url=" + u + $"&title={model.title}"; _ = GetUrlPage(1, u, feeds); }
public ActionResult Index(int?page) { var pageNumber = page ?? 1; var posts = this.Data.Posts.All().OrderByDescending(p => p.CreatedOn).ProjectTo <BlogPostConciseViewModel>(); var viewModel = new IndexPageViewModel { Posts = posts }; var model = viewModel.Posts.ToPagedList(pageNumber, PostsPerPageDefaultValue); return(this.View(model)); }
protected virtual IndexPageViewModel CreateIndexPageViewModel(int page, SheetFilterViewModel filter = null) { var model = new IndexPageViewModel(); var claim = User.Claims.FirstOrDefault(x => x.Type.Equals(Constants.Claims.ReferenceId)); var sheetFilter = CreateFilter(filter, claim.Value); var totalCount = ExamSheetManager.GetTotal(sheetFilter); model.Page = new PageViewModel(totalCount, page, PageSize); model.ExamSheets = ExamSheetManager.FindAll(sheetFilter, page, PageSize).Select(ExamSheetListViewModel).ToList(); model.Filter = CreateFilterModel(claim.Value, filter); return(model); }
public ViewResult Index() { IndexPageViewModel model = new IndexPageViewModel() { CurrentAge = DateHelper.GetYearDifference(_birthDate, DateTime.UtcNow), WorkExperiences = _repository.GetWorkExperiences(), UniversityDiplomas = _repository.GetUniversityDiplomas(), PersonalWork = _repository.GetPersonalWork() }; return(View(model)); }
public ActionResult Index() { var startDate = DateTime.Now; var endDate = startDate.AddMonths(1); var model = new IndexPageViewModel() { ScheduleStart = startDate, ScheduleEnd = endDate, Runs = _runRepo.GetRuns(startDate, endDate), Trains = _trainRepo.GetAllTrains().ToDictionary(x => x.Id) }; return(View(model)); }
public ActionResult Index(int page = 1, int perPage = GlobalConstants.DefaultPageSize) { var pagesCount = (int)Math.Ceiling(this.postsData.All().Count() / (decimal)perPage); var postsPage = this.postsData.All().OrderByDescending(p => p.CreatedOn).Skip(perPage * (page - 1)).Take(perPage); var posts = this.Mapper.Map <PostConciseViewModel>(postsPage).ToList(); var model = new IndexPageViewModel { Posts = posts, CurrentPage = page, PagesCount = pagesCount }; return(this.View(model)); }
public ActionResult Index() { PortalServiceProxy proxy = new PortalServiceProxy(); var viewModel = new IndexPageViewModel() { MostPopularApps = proxy.GetMostPopularApps(), SpecialApps = proxy.GetSpecialApps(), ChosenApps = proxy.GetChosenApps(), NewApps = proxy.GetNewApps(), RisingApps = proxy.GetNewApps(), SpecialGames = proxy.GetSpecialGames() }; return(PartialView(viewModel)); }
public void TestTournament_ShouldReturnTournamentName() { var tmock = new Mock <ITournament>(); tmock.Setup(t => t.GetName()) .Returns("VM 2014 Brasil"); var bmock = new Mock <ISubmittedBets>(); bmock.Setup(f => f.GetBetters()).Returns(new List <string>()); var amock = new Mock <IResults>(); var groups = new IndexPageViewModel(tmock.Object, bmock.Object, amock.Object); groups.Tournament.ShouldBe("VM 2014 Brasil"); }
public async Task <IActionResult> Pagination(int page = 1) { int pageSize = 1; IIncludableQueryable <MetanitExampleCoreMVC.Models.User, Company> source = dbUsers.Users.Include(x => x.Company); var count = await source.CountAsync(); var items = await source.Skip((page - 1) *pageSize).Take(pageSize).ToListAsync(); PageViewModel pageViewModel = new PageViewModel(count, page, pageSize); IndexPageViewModel viewModel = new IndexPageViewModel() { PageViewModel = pageViewModel, Users = items }; return(View(viewModel)); }
public IActionResult Index() { System.Security.Claims.ClaimsPrincipal currentUser = this.User; var userID = _userManager.GetUserId(currentUser); var user = _context.Users.Include(x => x.Msp).Include(x => x.Declarations).FirstOrDefault(x => x.Id == userID); if (user == null) { return(Content("error")); } IndexPageViewModel model = new IndexPageViewModel() { User = user, }; return(View(model)); }
public async Task <IActionResult> Index(int page = 1) { int pageSize = SettingModel.TopicsPerPage; var topicList = await TopicService.QueryNotTrash(page, pageSize, Core.Enums.TopicStatus.Published, null); var vm = new IndexPageViewModel { TopicList = new TopicListModel { Data = topicList.Data, PageIndex = page, PageSize = pageSize, Total = topicList.Total } }; return(View(vm)); }
public async Task <ActionResult> Index(string userName = "", string titleSearch = "", string tag = "") { var req = new GetRefListsRequest( null, userName, null, tag, titleSearch, null, PublishingStatusConditionKind.PublishOnly, 0, WebConsts.RefListsPageSize, RefListSortKind.PublishedDateDescending ); var result = await _refListHandler.GetRefListsAsync(req); var vm = new IndexPageViewModel() { Tag = tag, PageIndex = result.PageIndex + 1, PageCount = result.PageCount, RefLists = Mapper.Map <ICollection <RefListViewModel> >(result.RefLists), }; return(View(vm)); }
private void Pivot_Loaded(object sender, RoutedEventArgs e) { Pivot element = sender as Pivot; index = element.SelectedIndex; if (element.Items.Count == 0) { Entity[] f = element.Tag as Entity[]; Style style = new Style(typeof(ListViewItem)); style.Setters.Add(new Setter(TemplateProperty, Application.Current.Resources["ListViewItemTemplate1"] as ControlTemplate)); for (int j = 0; j < f.Length; j++) { IndexPageViewModel model = f[j] as IndexPageViewModel; var ff = new ObservableCollection <Entity>(); var l = new ListView { Style = Application.Current.Resources["ListViewStyle"] as Style, ItemContainerStyle = style, ItemTemplateSelector = Resources["FTemplateSelector"] as DataTemplateSelector, ItemsSource = ff, ItemsPanel = Windows.UI.Xaml.Markup.XamlReader.Load("<ItemsPanelTemplate xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" xmlns:c=\"using:CoolapkUWP.Control\"><c:GridPanel DesiredColumnWidth=\"384\" CubeInSameHeight=\"False\"/></ItemsPanelTemplate>") as ItemsPanelTemplate, SelectionMode = ListViewSelectionMode.None }; l.SetValue(ScrollViewer.VerticalScrollModeProperty, ScrollMode.Disabled); var i = new PivotItem { Tag = f[j], Content = l, Header = model.title }; element.Items.Add(i); pages.Add(1); Feeds2.Add(ff); urls.Add("/page/dataList?url=" + model.url.Replace("#", "%23") + $"&title={model.title}"); if (j == 0) { load(element, i); } } return; } }
public async Task <IActionResult> Index(string genre = null) { var movies = genre.IsNullOrEmpty() ? await _connection.GetAllOfLabel <Movie>() : await _connection.FindAllForLabel <Movie>((Constants.Genre, genre)); var genres = new HashSet <string>((await _connection.GetAllOfLabel <Movie>()).Select(x => x.Genre)); var movieViewModels = new List <MovieViewModel>(); foreach (var movie in movies) { var boughtCount = await _connection.CountRelationships <Movie, User>(movie, Constants.BoughtLabel); movieViewModels.Add(new MovieViewModel(movie, boughtCount)); } var indexPageViewModel = new IndexPageViewModel(movieViewModels, genres); return(View(indexPageViewModel)); }
public ActionResult Index(int page = 1, int perPage = GlobalConstants.DefaultPageSize) { int pagesCount = (int) Math.Ceiling(this.Data.Posts.All().Count() / (decimal) perPage); var posts = this.Data.Posts .All() .Where(p => !p.IsDeleted) .OrderByDescending(p => p.CreatedOn) .To<BlogPostConciseViewModel>() .Skip(perPage*(page - 1)) .Take(perPage); var model = new IndexPageViewModel { Posts = posts.ToList(), CurrentPage = page, PagesCount = pagesCount }; return this.View(model); }
// GET: Administration/ApplicationUsers public ActionResult Index(int page = 1, int perPage = GlobalConstants.DefaultPageSize) { int pagesCount = (int) Math.Ceiling(this.Data.Users.All().Count() / (decimal) perPage); var users = this.Data.Users .All() .OrderByDescending(u => u.CreatedOn) .To<ApplicationUserViewModel>() .Skip(perPage * (page - 1)) .Take(perPage); var model = new IndexPageViewModel { Users = users.ToList(), CurrentPage = page, PagesCount = pagesCount, }; return this.View(model); }
/// <summary> /// NavigationServiceを受け取るためのコンストラクタ /// </summary> /// <param name="navigationService"></param> public MainPageViewModel(INavigationService navigationService) { this.navigationService = navigationService; // URLを初期化 var resLoader = ResourceLoader.GetForCurrentView("Resources"); RouteUrl = resLoader.GetString("routeurl"); ProgramUrl = resLoader.GetString("programurl"); InfoUrl = resLoader.GetString("infourl"); NoticeViewModel = new IndexPageViewModel(this.navigationService); ResultViewModel = new IndexPageViewModel(this.navigationService); PhotoViewModel = new IndexPageViewModel(this.navigationService); }