Exemplo n.º 1
0
        public async Task <Item> ModifyItem(Guid playerid, Guid itemid, ModifiedItem item)
        {
            await Task.CompletedTask;
            Item found = GetItemById(playerid, itemid);

            if (found != null)
            {
                found.Level = item.Level;
            }
            return(found);
        }
        public async Task <Item> ModifyItem(Guid playerid, Guid itemid, ModifiedItem item)
        {
            var filter = Builders <Player> .Filter.Eq("Id", playerid);

            var cursor = await collection.FindAsync(filter);

            Player player = cursor.First();

            foreach (Item item2 in player.items)
            {
                if (item2.Id == itemid)
                {
                    if (item2 != null)
                    {
                        item2.Level = item.Level;
                        await collection.FindOneAndReplaceAsync(filter, player);
                    }
                    return(item2);
                }
            }
            return(null);
        }
Exemplo n.º 3
0
 public Task <Item> Modify(Guid playerid, Guid itemid, ModifiedItem item)
 {
     return(_repository.ModifyItem(playerid, itemid, item));
 }
Exemplo n.º 4
0
 public Task <Item> Modify(Guid playerid, Guid itemid, [FromBody] ModifiedItem item)
 {
     return(_processor.Modify(playerid, itemid, item));
 }