using Microsoft.EntityFrameworkCore; using Icarus.Models; namespace Icarus.Database.Contexts; public class GenreContext : DbContext { public DbSet Genres { get; set; } public GenreContext(DbContextOptions options) : base(options) { } public GenreContext(string connString) : base(new DbContextOptionsBuilder() .UseMySQL(connString).Options) { } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity() .ToTable("Genre"); } public Genre RetrieveRecord(Genre genre) { return Genres.FirstOrDefault(gnr => gnr.Id == genre.Id); } public bool DoesRecordExist(Genre genre) { return Genres.FirstOrDefault(gnr => gnr.Id == genre.Id) != null ? true : false; } }