using System.Collections.Generic; using Sony.Filtr.Contracts.Entities; using Sony.Filtr.Database; namespace Sony.Filtr.Playlists { public class EditorialPlaylistThemeManager { public EditorialPlaylistTheme AddTheme(EditorialPlaylistTheme theme) { using (var conn = DatabaseHandler.GetOpenConnection()) { var cmd = conn.CreateCommand(); cmd.CommandText = "INSERT INTO EditorialPlaylistTheme (AccentColor, BackgroundColor, HeaderBackgroundColor, HeaderImageUrl,ThemeActive)" + " VALUES (@AccentColor, @BackgroundColor, @HeaderBackgroundColor, @HeaderImageUrl, @ThemeActive)"; cmd.Parameters.AddWithValue("@AccentColor", theme.AccentColor); cmd.Parameters.AddWithValue("@BackgroundColor", theme.BackgroundColor); cmd.Parameters.AddWithValue("@HeaderBackgroundColor", theme.HeaderBackgroundColor); cmd.Parameters.AddWithValue("@HeaderImageUrl", theme.HeaderImageUrl); cmd.Parameters.AddWithValue("@ThemeActive", theme.ThemeActive); cmd.ExecuteNonQuery(); conn.Close(); } return theme; } public List GetEditorialPlaylistThemes() { return new List(); } public void DeleteTheme(EditorialPlaylistTheme theme) { return; } public void UpdateTheme(EditorialPlaylistTheme theme) { using (var conn = DatabaseHandler.GetOpenConnection()) { var cmd = conn.CreateCommand(); cmd.CommandText = "UPDATE EditorialPlaylistTheme SET " + "AccentColor=@AccentColor, " + "BackgroundColor=@BackgroundColor, " + "HeaderBackgroundColor=@HeaderBackgroundColor, " + "HeaderImageUrl=@HeaderImageUrl," + "ThemeActive=@ThemeActive " + "WHERE ID=@themeID"; cmd.Parameters.AddWithValue("@AccentColor", theme.AccentColor); cmd.Parameters.AddWithValue("@BackgroundColor", theme.BackgroundColor); cmd.Parameters.AddWithValue("@HeaderBackgroundColor", theme.HeaderBackgroundColor); cmd.Parameters.AddWithValue("@HeaderImageUrl", theme.HeaderImageUrl); cmd.Parameters.AddWithValue("@ThemeActive", theme.ThemeActive); cmd.Parameters.AddWithValue("@ThemeId", theme.ID); cmd.ExecuteNonQuery(); conn.Close(); } } } }