summaryrefslogtreecommitdiff
path: root/Models
diff options
context:
space:
mode:
authorSergey Chebotar <s.chebotar@gmail.com>2023-02-20 21:53:21 +0300
committerSergey Chebotar <s.chebotar@gmail.com>2023-02-20 21:53:21 +0300
commit3c83f9f4b01b5965e04739e5f8accf3235f8f699 (patch)
tree8ec80ceaf26f1343ecccab682e9041689f4f5701 /Models
parentc740669676b30e5eae3cbadbef2810671b9e1c37 (diff)
Add base crud actions for bundles
Diffstat (limited to 'Models')
-rw-r--r--Models/IRepository.cs10
-rw-r--r--Models/MyDarlingRepository.cs32
2 files changed, 0 insertions, 42 deletions
diff --git a/Models/IRepository.cs b/Models/IRepository.cs
deleted file mode 100644
index 363f48d..0000000
--- a/Models/IRepository.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace MyDarling.Models
-{
- public interface IRepository
- {
- public IQueryable<UnderwearBundle> Bundles { get; }
- public void Add(UnderwearBundle b);
- public void Remove(UnderwearBundle p);
- public void Save();
- }
-} \ No newline at end of file
diff --git a/Models/MyDarlingRepository.cs b/Models/MyDarlingRepository.cs
deleted file mode 100644
index 15f058c..0000000
--- a/Models/MyDarlingRepository.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using Microsoft.EntityFrameworkCore;
-
-namespace MyDarling.Models
-{
- public class MyDarlingRepository : IRepository
- {
- private DataContext DbContext { get; }
- public MyDarlingRepository(IServiceProvider provider)
- {
- DbContext = provider.CreateScope().ServiceProvider.GetRequiredService<DataContext>();
- }
-
- public IQueryable<UnderwearBundle> 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();
- }
- }
-} \ No newline at end of file