public async Task <Item> ModifyItem(Guid id, ModifiedItem item) { string[] pena = File.ReadAllLines(gameDevName); Item[] tavarat = new Item[pena.Length]; int count = 0; Item itemsingle; foreach (var a in pena) { itemsingle = JsonConvert.DeserializeObject <Item>(pena[count]); tavarat[count] = itemsingle; count++; } count = 0; var result = new Item(); foreach (var c in tavarat) { if (c.Id == id) { c.Level = item.Level; result = c; pena[count] = JsonConvert.SerializeObject(result); File.WriteAllLines(gameDevName, pena); break; } count++; } return(result); }
public Task <Item> Modify(Guid id, ModifiedItem item) { if (item.ItemType == "Sword" && item.player.Level < 3) { throw new RuleNotFollowedException(); } return(repo.Modify(id, item)); }
public Task <Item> Modify(Guid id, ModifiedItem item) { foreach (Item i in itemList) { if (i.ItemID == id) { i.OwningPlayer = item.player.Id; return(Task.FromResult(i)); } } return(null); }
public Task <Item> ModifyItem(Guid id, ModifiedItem item) { throw new NotImplementedException(); }
public async Task <Item> ModifyItem(Guid playerId, ModifiedItem item) { return(await _repository.ModifyItem(playerId, item)); }
public Task <Item> Modify(Guid id, [FromBody] ModifiedItem item) { return(processor.Modify(id, item)); }