コード例 #1
0
        public IHttpActionResult GetGenre(int id)
        {
            Genre genre = _dALGenre.GetGenreById(id);

            if (genre == null)
            {
                return(NotFound());
            }
            return(Ok(genre));
        }
コード例 #2
0
        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());
            }
        }
コード例 #3
0
        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);
        }