public IActionResult Details(int?Id) { // Assert series id if (Id == null || Id == 0) { return(NotFound()); } // Find series by id and assert the result Series series = _seriesRepository.GetById((int)Id); if (series == null) { return(NotFound()); } return(View(series)); }
// View component logic public IViewComponentResult Invoke(int?SeriesId) { // Menu view model SeriesMenuViewModel seriesMenuViewModel = new SeriesMenuViewModel(); seriesMenuViewModel.series = _seriesRepository.GetById((int)SeriesId); seriesMenuViewModel.watchlists = _watchlistRepository.GetAll.OrderBy(wl => wl.Title); return(View(seriesMenuViewModel)); }