Files
CouchLog/CouchLog/OnStartUp.cs

130 lines
5.4 KiB
C#

using CouchLog.Data;
namespace CouchLog
{
public class OnStartUp
{
private ApplicationDbContext CouchLogDB;
public OnStartUp(ApplicationDbContext CouchLogDB)
{
this.CouchLogDB = CouchLogDB;
}
public void AddBasicDatabaseEntries()
{
//##################
//### MediaTypes ###
//##################
List<MediaType> MediaTypes = new List<MediaType>
{
//Video based
new() { Name="Movie" },
new() { Name="Series" },
new() { Name="Anime" },
new() { Name="Documentary" },
new() { Name="Short Film" },
//new() { Name="Music Video" },
//new() { Name="Live Performance" },
//Audio based
new() { Name="Podcast" },
new() { Name="Audiobook" },
new() { Name="Music Album" },
//Interactive
new() { Name="Video Game" },
//Text based
new() { Name = "Book" },
new() { Name = "Comic" },
};
foreach (MediaType MediaType in MediaTypes)
{
if(!CouchLogDB.MediaType.Any(m => m.Name == MediaType.Name))
{
CouchLogDB.MediaType.Add(MediaType);
}
}
//##############
//### Genres ###
//##############
List<Genre> Genres = new List<Genre>
{
new() { Name = "Action", CreationTime = DateTime.Now },
new() { Name = "Animation", CreationTime = DateTime.Now },
new() { Name = "Comedy", CreationTime = DateTime.Now },
new() { Name = "Crime", CreationTime = DateTime.Now },
new() { Name = "Drama", CreationTime = DateTime.Now },
new() { Name = "Fantasy", CreationTime = DateTime.Now },
new() { Name = "History", CreationTime = DateTime.Now },
new() { Name = "Horror", CreationTime = DateTime.Now },
new() { Name = "Musical", CreationTime = DateTime.Now },
new() { Name = "Miniseries", CreationTime = DateTime.Now },
new() { Name = "Mystery", CreationTime = DateTime.Now },
new() { Name = "Romance", CreationTime = DateTime.Now },
new() { Name = "Science Fiction", CreationTime = DateTime.Now },
new() { Name = "Thriller", CreationTime = DateTime.Now },
new() { Name = "War", CreationTime = DateTime.Now },
new() { Name = "Western", CreationTime = DateTime.Now },
};
foreach(Genre Genre in Genres)
{
if(!CouchLogDB.Genres.Any(m => m.Name == Genre.Name))
{
CouchLogDB.Genres.Add(Genre);
}
}
//##########################
//### StreamingPlatforms ###
//##########################
List<StreamingPlatform> StreamingPlatforms = new List<StreamingPlatform>
{
new() { Name = "Netflix", PicturePath="StreamingPlatforms/Netflix.png", CreationTime = DateTime.Now },
new() { Name = "Prime Video", PicturePath="StreamingPlatforms/Prime-Video.png", CreationTime = DateTime.Now },
new() { Name = "Disney+", PicturePath="StreamingPlatforms/Disney+.png", CreationTime = DateTime.Now },
new() { Name = "Apple TV", PicturePath="StreamingPlatforms/AppleTV.png", CreationTime = DateTime.Now },
new() { Name = "WOW TV", PicturePath="StreamingPlatforms/WOWTV.png", CreationTime = DateTime.Now },
new() { Name = "Paramount+", PicturePath="StreamingPlatforms/Paramount+.png", CreationTime = DateTime.Now },
new() { Name = "Joyn", PicturePath="StreamingPlatforms/Joyn.png", CreationTime = DateTime.Now },
};
foreach(StreamingPlatform StreamingPlatform in StreamingPlatforms)
{
if(!CouchLogDB.StreamingPlatforms.Any(m => m.Name == StreamingPlatform.Name))
{
CouchLogDB.StreamingPlatforms.Add(StreamingPlatform);
}
}
//##########################
//###### WatchStates #######
//##########################
List<UserWatchStatus> UserWatchStatuses = new List<UserWatchStatus>
{
new() { Name = "Not watched", CreationTime = DateTime.Now },
new() { Name = "Started", CreationTime = DateTime.Now },
new() { Name = "Finished", CreationTime = DateTime.Now },
new() { Name = "Paused", CreationTime = DateTime.Now },
new() { Name = "Aborted", CreationTime= DateTime.Now },
};
foreach(UserWatchStatus UserWatchStatus in UserWatchStatuses)
{
if(!CouchLogDB.UserWatchStatuses.Any(m => m.Name == UserWatchStatus.Name))
{
CouchLogDB.UserWatchStatuses.Add(UserWatchStatus);
}
}
CouchLogDB.SaveChanges();
}
}
}