using Microsoft.EntityFrameworkCore; namespace MyDarling.Models { public class MyDarlingRepository : IRepository { private DataContext DbContext { get; } public MyDarlingRepository(IServiceProvider provider) { DbContext = provider.CreateScope().ServiceProvider.GetRequiredService(); } public IQueryable Bundles => DbContext.UnderwearBundles.Include(b => b.Figures); public void Add(UnderwearBundle b) { DbContext.UnderwearBundles.Add(b); DbContext.SaveChanges(); } public void Remove(UnderwearBundle b) { DbContext.UnderwearBundles.Remove(b); DbContext.SaveChanges(); } public void Save() { DbContext.SaveChanges(); } } }