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