private async Task <ActionResult> MasterCharacterList(int projectId, Func <Character, bool> predicate, string export, string title, Func <CharacterListItemViewModel, bool> viewModelPredicate) { var characters = (await ProjectRepository.GetCharacters(projectId)).Where(predicate).ToList(); var error = await AsMaster(characters, projectId); if (error != null) { return(error); } var plots = await PlotRepository.GetPlotsWithTargets(projectId); var project = await GetProjectFromList(projectId, characters); var list = new CharacterListViewModel(CurrentUserId, title, characters, plots, project, viewModelPredicate); var exportType = GetExportTypeByName(export); if (exportType == null) { return(View("Index", list)); } return(await ExportWithCustomFronend(list.Items, list.Title, exportType.Value, new CharacterListItemViewModelExporter(list.Fields, UriService), list.ProjectName)); }
public CharacterListPage() { InitializeComponent(); BindingContext = viewModel = new CharacterListViewModel(); //service = App.CharacterService; ImageDownloadButton.IsVisible = false; }
private async Task <FileContentResult> Export(CharacterListViewModel list, ExportType?exportType) { var generator = ExportDataService.GetGenerator( exportType.Value, list.Items, new CharacterListItemViewModelExporter(list.Fields, UriService)); return(await ReturnExportResult(list.ProjectName + ": " + list.Title, generator)); }
public CharacterListPage(List <Character> inputCharacters) { InitializeComponent(); BindingContext = _viewModel = new CharacterListViewModel { Characters = new ObservableCollection <Character>(inputCharacters) }; MessagingCenter.Subscribe <GameSelectionPage>(this, "GameSelected", SourceCallback); }
private async Task <ActionResult> MasterCharacterList(int projectId, Func <Character, bool> predicate, string export, string title) { var characters = (await ProjectRepository.GetCharacters(projectId)).Where(predicate).ToList(); var project = await GetProjectFromList(projectId, characters); var list = new CharacterListViewModel(CurrentUserId, title, characters, project); var exportType = ExportTypeNameParserHelper.ToExportType(export); if (exportType == null) { return(View("Index", list)); } return(await Export(list, exportType)); }
public ActionResult About(int currentPage = 2, int pageSize = 10) { var response = ApiHelper.MarvelClient.FindCharacters( new CharacterRequestFilter { Offset = currentPage, Limit = pageSize }); var paging = new PageModel { CurrentPage = currentPage, ItemsPerPage = pageSize, TotalItems = int.Parse(response.Data.Total) }; CharacterListViewModel characterList = new CharacterListViewModel { Characters = response.Data.Results, PageInfo = paging }; return(View(characterList)); }
public ViewResult List() { IEnumerable <Character> characters = _character.Characters.OrderBy(c => c.Id); if (User.IsInRole("user")) { var userId = _allUsers.Users.FirstOrDefault(u => u.Email == User.Identity.Name)?.Id; characters = characters.Where(c => c.UserId == userId); } var characterViewModel = new CharacterListViewModel { Characters = characters, Races = _allRaces.Races.ToList(), CharClasses = _allClasses.CharClasses.ToList(), Users = _allUsers.Users }; ViewData["Title"] = "Персонажи"; return(View(characterViewModel)); }
public IActionResult Index() { var characters = _context.Characters .OrderBy(c => c.Order) .ToList(); if (characters != null) { var charList = new CharacterListViewModel { Characters = characters.Select(c => new CharacterViewModel { Icon = c.GetIcon(), Faction = c.Faction, Name = c.Name, CharacterId = c.CharacterId, }) .ToList() }; _logger.LogDebug("Loading a list of all characters"); return(View(charList)); } return(new NotFoundObjectResult(HttpStatusCode.BadRequest)); }
public CharacterListPage() { InitializeComponent(); BindingContext = viewModel = new CharacterListViewModel(); }
private void SourceCallback(GameSelectionPage obj) { BindingContext = _viewModel = new CharacterListViewModel(); }
public CharacterListPage() { InitializeComponent(); BindingContext = _viewModel = new CharacterListViewModel(); MessagingCenter.Subscribe <GameSelectionPage>(this, "GameSelected", SourceCallback); }