using System; using System.Collections.Generic; using System.Linq; using Microsoft.EntityFrameworkCore; using MySql.Data; using MySql.Data.EntityFrameworkCore.Extensions; using MySql.Data.MySqlClient; using Icarus.Models; namespace Icarus.Database.Contexts { public class CoverArtContext : DbContext { public DbSet CoverArtImages { get; set; } public CoverArtContext(DbContextOptions options) : base(options) { } public CoverArtContext(string connString) : base(new DbContextOptionsBuilder() .UseMySQL(connString).Options) { } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity() .ToTable("CoverArt"); } public bool DoesRecordExist(CoverArt cover) { return CoverArtImages.FirstOrDefault(cov => cov.CoverArtId == cover.CoverArtId) != null ? true : false; } } }