public ActionResult CreateGame() { var gameViewModel = new CreateGameViewModel(); var genresFromDb = _genreManager.GetAllGenres().ToList(); var platformsFromDb = _platformManager.GetAllPlatforms().ToList(); var publishersFromDb = _publisherManager.GetAllPublishers().ToList(); gameViewModel.AllGenres = new MultiSelectList(genresFromDb.OrderBy(i => i.Category), "Id", "Name", "Category"); gameViewModel.AllPlatforms = new MultiSelectList(platformsFromDb.OrderBy(i => i.Type), "Id", "Type"); gameViewModel.AllPublishers = new MultiSelectList(publishersFromDb.OrderBy(i => i.CompanyName), "Id", "CompanyName"); return(View("CreateGame", gameViewModel)); }
GetPlatformUserConnectionInfos(CancellationToken cancellationToken) { var uniqueUserIdentifier = _httpContextAccessor.HttpContext.User.Identity.Name; using var session = _documentStore.OpenAsyncSession(); var user = await _userManager.GetUserByUniqueIdentifier(uniqueUserIdentifier, session, cancellationToken); var platforms = await _platformManager.GetAllPlatforms(session, cancellationToken); var platformUserConnectionInfoViewModels = new List <PlatformUserConnectionInfoViewModel>(); foreach (var platform in platforms) { var platformConnection = user.PlatformConnections.SingleOrDefault(pc => pc.PlatformId == platform.Id); var isConnected = !platformConnection?.ConnectionInfo?.IsDeleted ?? false; var disconnectReason = platformConnection?.ConnectionInfo?.DeleteReason; platformUserConnectionInfoViewModels.Add(new PlatformUserConnectionInfoViewModel( platform.ExternalId, platform.Name, platform.Description, platform.LogoUrl, platform.WebsiteUrl, isConnected, platform.AuthenticationMechanism, disconnectReason, platformConnection.LastSuccessfulDataFetch)); } return(platformUserConnectionInfoViewModels); }
public FilterViewModel(IGenreManager genreManager, IPlatformManager platformTypeManager, IPublisherManager publisherManager) { _genreManager = genreManager; _platformManager = platformTypeManager; _publisherManager = publisherManager; SelectedGenres = new List <int>(); SelectedPlatforms = new List <int>(); SelectedPublishers = new List <int>(); AllGenres = new MultiSelectList(_genreManager.GetAllGenres().OrderBy(g => g.Category), "Id", "Name", "Category"); AllPlatforms = new MultiSelectList(_platformManager.GetAllPlatforms().OrderBy(g => g.Type), "Id", "Type"); ; AllPublishers = new MultiSelectList(_publisherManager.GetAllPublishers().OrderBy(i => i.CompanyName), "Id", "CompanyName"); ItemsPerPage = new SelectList(new List <string> { "2", "10", "20", "50", "100", "All" }); //FilterByOptions = new SelectList(); //WhenPublished = new SelectList(); }