public IActionResult Index([FromQuery] string name, [FromQuery] int?age) { var characters = _charactersRepository.GetAll(). Where(character => character.Name.Equals(name ?? character.Name) && character.Age.Equals(age ?? character.Age)). Select(character => new CharactersIndexViewModel { CharacterId = character.Id, CharacterName = character.Name, StoryName = character.Story.Name }).ToList(); return(View(characters)); }
public IActionResult Index() { HomeIndexViewModel viewModel = new HomeIndexViewModel { Characters = _charactersRepository.GetAll(), Stories = _storyRepository.GetAll() }; return(View(viewModel)); }
public IActionResult SingleCharacter(int id) { var character = _charactersRepository.GetAll().Single(x => x.Id == id); return(View(character)); }