Exemplo n.º 1
0
        public async Task DeleteAsync(ulong userId, int backgroundId)
        {
            var backInv = new RiftBackgroundInventory
            {
                UserId       = userId,
                BackgroundId = backgroundId
            };

            await DeleteAsync(backInv);
        }
Exemplo n.º 2
0
 public async Task DeleteAsync(RiftBackgroundInventory backInv)
 {
     await using var context = new RiftContext();
     if (await context.BackgroundInventories
         .AsQueryable()
         .AnyAsync(x => x.Equals(backInv)))
     {
         context.BackgroundInventories.Remove(backInv);
         await context.SaveChangesAsync();
     }
 }
Exemplo n.º 3
0
        public async Task AddAsync(ulong userId, int backgroundId)
        {
            if (!await DB.Users.EnsureExistsAsync(userId))
            {
                throw new DatabaseException(nameof(BackgroundInventory) + nameof(AddAsync));
            }

            var backInv = new RiftBackgroundInventory
            {
                UserId       = userId,
                BackgroundId = backgroundId
            };

            await using var context = new RiftContext();
            await context.BackgroundInventories.AddAsync(backInv);

            await context.SaveChangesAsync();
        }