summaryrefslogtreecommitdiff
path: root/Models/MyDarlingRepository.cs
diff options
context:
space:
mode:
authorSergey Chebotar <s.chebotar@gmail.com>2023-02-16 08:28:59 +0300
committerSergey Chebotar <s.chebotar@gmail.com>2023-02-16 08:28:59 +0300
commite4b4105ec0802dd0f1b735e5cb7fba083a0ffe0c (patch)
treed857967fb3f6bf5ce7caa7359d4b4f864d5b2bc9 /Models/MyDarlingRepository.cs
parent9107bb6788428a3504adbeea2bc5c060e17f895d (diff)
Add edit page
Diffstat (limited to 'Models/MyDarlingRepository.cs')
-rw-r--r--Models/MyDarlingRepository.cs48
1 files changed, 24 insertions, 24 deletions
diff --git a/Models/MyDarlingRepository.cs b/Models/MyDarlingRepository.cs
index 07caff8..15f058c 100644
--- a/Models/MyDarlingRepository.cs
+++ b/Models/MyDarlingRepository.cs
@@ -2,31 +2,31 @@ using Microsoft.EntityFrameworkCore;
namespace MyDarling.Models
{
- public class MyDarlingRepository : IRepository
- {
- private DataContext context;
- public MyDarlingRepository(IServiceProvider provider)
- {
- context = provider.CreateScope().ServiceProvider.GetRequiredService<DataContext>();
- }
-
- public IQueryable<UnderwearBundle> Bundles => context.UnderwearBundles.Include(b => b.Figures);
+ public class MyDarlingRepository : IRepository
+ {
+ private DataContext DbContext { get; }
+ public MyDarlingRepository(IServiceProvider provider)
+ {
+ DbContext = provider.CreateScope().ServiceProvider.GetRequiredService<DataContext>();
+ }
- public void Add(UnderwearBundle b)
- {
- context.UnderwearBundles.Add(b);
- context.SaveChanges();
- }
+ public IQueryable<UnderwearBundle> Bundles => DbContext.UnderwearBundles.Include(b => b.Figures);
- public void Remove(UnderwearBundle b)
- {
- context.UnderwearBundles.Remove(b);
- context.SaveChanges();
- }
+ public void Add(UnderwearBundle b)
+ {
+ DbContext.UnderwearBundles.Add(b);
+ DbContext.SaveChanges();
+ }
- public void Save()
- {
- context.SaveChanges();
- }
- }
+ public void Remove(UnderwearBundle b)
+ {
+ DbContext.UnderwearBundles.Remove(b);
+ DbContext.SaveChanges();
+ }
+
+ public void Save()
+ {
+ DbContext.SaveChanges();
+ }
+ }
} \ No newline at end of file