public IHttpActionResult GetGenre(int id) { Genre genre = _dALGenre.GetGenreById(id); if (genre == null) { return(NotFound()); } return(Ok(genre)); }
private void AddGenreExecute() { try { int selectedGenreId = _dALGenre.AllGenres().ElementAt(SelectedGenre).Id; var genre = _dALGenre.GetGenreById(selectedGenreId); if (!_movieGenres.Exists(g => g.Id == genre.Id)) { _movieGenres.Add(genre); } Genre = null; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private string GenresForMovie() { int iterator = 0; foreach (var genre in _currentMovie.Genres) { var movieGenre = _dALGenre.GetGenreById(genre.Id); if (movieGenre != null) { genres += movieGenre.Name; iterator++; if (iterator < _currentMovie.Genres.Count) { genres += ", "; } } } return(genres); }