From d26efb3c8c4f57a1f5419ef8a5ce7fd5e43eab35 Mon Sep 17 00:00:00 2001
From: Toastie <toastie@toastiet0ast.com>
Date: Sun, 23 Mar 2025 15:53:06 +1300
Subject: [PATCH] fixed .shop commands

---
 .../Modules/Gambling/Shop/ShopCommands.cs        | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/EllieBot/Modules/Gambling/Shop/ShopCommands.cs b/src/EllieBot/Modules/Gambling/Shop/ShopCommands.cs
index 8d028d5..37a960d 100644
--- a/src/EllieBot/Modules/Gambling/Shop/ShopCommands.cs
+++ b/src/EllieBot/Modules/Gambling/Shop/ShopCommands.cs
@@ -332,17 +332,18 @@ public partial class Gambling
                 Type = ShopEntryType.Role,
                 AuthorId = ctx.User.Id,
                 RoleId = role.Id,
-                RoleName = role.Name
+                RoleName = role.Name,
+                GuildId = ctx.Guild.Id,
             };
             await using (var uow = _db.GetDbContext())
             {
                 var entries = new IndexedCollection<ShopEntry>(await uow.Set<ShopEntry>()
                     .Where(x => x.GuildId == ctx.Guild.Id)
                     .Include(x => x.Items)
-                    .ToListAsyncEF())
-                {
-                    entry
-                };
+                    .ToListAsyncEF());
+                
+                entries.Add(entry);
+                uow.Add(entry);
                 await uow.SaveChangesAsync();
             }
 
@@ -363,7 +364,8 @@ public partial class Gambling
                 Price = price,
                 Type = ShopEntryType.List,
                 AuthorId = ctx.User.Id,
-                Items = new()
+                Items = new(),
+                GuildId = ctx.Guild.Id
             };
             await using (var uow = _db.GetDbContext())
             {
@@ -440,7 +442,7 @@ public partial class Gambling
                 var items = await uow.Set<ShopEntry>()
                     .Where(x => x.GuildId == ctx.Guild.Id)
                     .Include(x => x.Items)
-                    .ToListAsyncLinqToDB();
+                    .ToListAsyncEF();
 
                 var entries = new IndexedCollection<ShopEntry>(items);
                 removed = entries.ElementAtOrDefault(index);