fixed .shop commands
This commit is contained in:
parent
16025b74e3
commit
d26efb3c8c
1 changed files with 9 additions and 7 deletions
|
@ -332,17 +332,18 @@ public partial class Gambling
|
||||||
Type = ShopEntryType.Role,
|
Type = ShopEntryType.Role,
|
||||||
AuthorId = ctx.User.Id,
|
AuthorId = ctx.User.Id,
|
||||||
RoleId = role.Id,
|
RoleId = role.Id,
|
||||||
RoleName = role.Name
|
RoleName = role.Name,
|
||||||
|
GuildId = ctx.Guild.Id,
|
||||||
};
|
};
|
||||||
await using (var uow = _db.GetDbContext())
|
await using (var uow = _db.GetDbContext())
|
||||||
{
|
{
|
||||||
var entries = new IndexedCollection<ShopEntry>(await uow.Set<ShopEntry>()
|
var entries = new IndexedCollection<ShopEntry>(await uow.Set<ShopEntry>()
|
||||||
.Where(x => x.GuildId == ctx.Guild.Id)
|
.Where(x => x.GuildId == ctx.Guild.Id)
|
||||||
.Include(x => x.Items)
|
.Include(x => x.Items)
|
||||||
.ToListAsyncEF())
|
.ToListAsyncEF());
|
||||||
{
|
|
||||||
entry
|
entries.Add(entry);
|
||||||
};
|
uow.Add(entry);
|
||||||
await uow.SaveChangesAsync();
|
await uow.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +364,8 @@ public partial class Gambling
|
||||||
Price = price,
|
Price = price,
|
||||||
Type = ShopEntryType.List,
|
Type = ShopEntryType.List,
|
||||||
AuthorId = ctx.User.Id,
|
AuthorId = ctx.User.Id,
|
||||||
Items = new()
|
Items = new(),
|
||||||
|
GuildId = ctx.Guild.Id
|
||||||
};
|
};
|
||||||
await using (var uow = _db.GetDbContext())
|
await using (var uow = _db.GetDbContext())
|
||||||
{
|
{
|
||||||
|
@ -440,7 +442,7 @@ public partial class Gambling
|
||||||
var items = await uow.Set<ShopEntry>()
|
var items = await uow.Set<ShopEntry>()
|
||||||
.Where(x => x.GuildId == ctx.Guild.Id)
|
.Where(x => x.GuildId == ctx.Guild.Id)
|
||||||
.Include(x => x.Items)
|
.Include(x => x.Items)
|
||||||
.ToListAsyncLinqToDB();
|
.ToListAsyncEF();
|
||||||
|
|
||||||
var entries = new IndexedCollection<ShopEntry>(items);
|
var entries = new IndexedCollection<ShopEntry>(items);
|
||||||
removed = entries.ElementAtOrDefault(index);
|
removed = entries.ElementAtOrDefault(index);
|
||||||
|
|
Loading…
Add table
Reference in a new issue