public MovieDataModel()
{
_movieCategories = new List<MovieCategories>();
// ドラマ
var category1 = new MovieCategories("Drama");
category1.AddTitles("Movie Title...", "Description", "PG");
category1.AddTitles("Movie Title...", "Description", "R");
category1.AddTitles("Movie Title...", "Description", "PG-13");
category1.AddTitles("Movie Title...", "Description", "PG");
category1.AddTitles("Movie Title...", "Description", "R");
category1.AddTitles("Movie Title...", "Description", "R");
category1.AddTitles("Movie Title...", "Description", "PG-13");
category1.AddTitles("Movie Title...", "Description", "PG-13");
category1.AddTitles("Movie Title...", "Description", "NR");
category1.AddTitles("Movie Title...", "Description", "NR");
// Categories コレクションに追加
_movieCategories.Add(category1);
// アクション
var category2 = new MovieCategories("Action");
category2.AddTitles("Movie Title...", "Description", "R");
category2.AddTitles("Movie Title...", "Description", "PG-13");
category2.AddTitles("Movie Title...", "Description", "PG-13");
category2.AddTitles("Movie Title...", "Description", "R");
category2.AddTitles("Movie Title...", "Description", "PG");
category2.AddTitles("Movie Title...", "Description", "PG-13");
category2.AddTitles("Movie Title...", "Description", "PG-13");
category2.AddTitles("Movie Title...", "Description", "NR");
category2.AddTitles("Movie Title...", "Description", "R");
category2.AddTitles("Movie Title...", "Description", "NR");
// Categories コレクションに追加
_movieCategories.Add(category2);
// コメディ
var category3 = new MovieCategories("Commedy");
category3.AddTitles("Movie Title...", "Description", "PG-13");
category3.AddTitles("Movie Title...", "Description", "R");
category3.AddTitles("Movie Title...", "Description", "R");
category3.AddTitles("Movie Title...", "Description", "R");
category3.AddTitles("Movie Title...", "Description", "PG-13");
category3.AddTitles("Movie Title...", "Description", "PG-13");
category3.AddTitles("Movie Title...", "Description", "PG-13");
category3.AddTitles("Movie Title...", "Description", "PG");
category3.AddTitles("Movie Title...", "Description", "R");
category3.AddTitles("Movie Title...", "Description", "NR");
// Categories コレクションに追加
_movieCategories.Add(category3);
// ドキュメンタリー
var category4 = new MovieCategories("Documentary");
category4.AddTitles("Movie Title...", "Description", "PG");
category4.AddTitles("Movie Title...", "Description", "R");
category4.AddTitles("Movie Title...", "Description", "PG");
category4.AddTitles("Movie Title...", "Description", "PG");
category4.AddTitles("Movie Title...", "Description", "PG-13");
category4.AddTitles("Movie Title...", "Description", "PG-13");
category4.AddTitles("Movie Title...", "Description", "PG-13");
category4.AddTitles("Movie Title...", "Description", "PG");
category4.AddTitles("Movie Title...", "Description", "R");
category4.AddTitles("Movie Title...", "Description", "NR");
// Categories コレクションに追加
_movieCategories.Add(category4);
}
private List<MovieCategories> _movieCategories;
public List<MovieCategories> MovieCategories
{
get { return _movieCategories; }
set
{
if (_movieCategories != null && _movieCategories == value) return;
_movieCategories = value;
}
}
}
// MovieCategories クラス
public class MovieCategories
{
// コンストラクター
public MovieCategories(string movieCategory)
{
_movieCategory = movieCategory;
}
public void AddTitles(string title, string description, string rating)
{
_movieList.Add(new MovieList(title, description, rating));
}
private string _movieCategory;
public string MovieCategory
{
get { return _movieCategory; }
set
{
if (_movieCategory != null && _movieCategory == value) return;
_movieCategory = value;
}
}
private List<MovieList> _movieList =
new List<MovieList>();
public List<MovieList> MovieList
{
get { return _movieList; }
set
{
if (_movieList != null && _movieList == value) return;
_movieList = value;
}
}
}
// MovieList クラス
public class MovieList
{
private string _movieTitle;
public string MovieTitle
{
get { return _movieTitle; }
set
{
if (_movieTitle != null && _movieTitle == value) return;
_movieTitle = value;
}
}
private string _movieDescription;
public string MovieDescription
{
get { return _movieDescription; }
set
{
if (_movieDescription != null && _movieDescription == value) return;
_movieDescription = value;
}
}
private string _movieRating;
public string MovieRating
{
get { return _movieRating; }
set
{
if (_movieRating != null && _movieRating == value) return;
_movieRating = value;
}
}
public MovieList(string movieTitle, string movieDescription, string movieRating)
{
_movieTitle = movieTitle;
_movieDescription = movieDescription;
_movieRating = movieRating;
}
}