Exemplo n.º 1
0
        public async Task <Item> Create(Guid playerID, NewItem item)
        {
            Item i = new Item();

            Player p = await repo.GetPlayer(item.OwningPlayer);


            i.OwningPlayer = item.OwningPlayer;


            if (item.ItemType == "Sword" && p.Level < 3)
            {
                throw new RuleNotFollowedException();
            }

            i.Level        = item.Level;
            i.ItemID       = Guid.NewGuid();
            i.ItemType     = item.ItemType;
            i.CreationDate = DateTime.Now;



            return(await repo.CreateItem(p.Id, i));
        }
Exemplo n.º 2
0
 public Task <Item> Create(Guid id, [FromBody] NewItem item)
 {
     return(processor.Create(id, item));
 }