public async Task <IActionResult> Edit(int id) { var editGenre = await _genre.GetById(id); if (editGenre == null) { return(RedirectToAction("Index")); } return(View(editGenre)); }
public async Task <IActionResult> Detail(int id) { Genre genre = await _genres.GetById(id); if (genre != null) { ICollection <Movie> movies = await _genres.GetMovies(id); var detailModel = new GenreDetailModel { Id = genre.Id, Name = genre.Name, Movies = movies .Select(movie => new KeyValuePair <int, string>(movie.Id, movie.Title)) .ToDictionary(kvp => kvp.Key, kvp => kvp.Value) }; return(View(detailModel)); } return(NotFound()); }
public async Task <IActionResult> GetById(int id) { var user = await _genre.GetById(id); return(Ok(user)); }