public Task <Item> Create(Guid playerid, NewItem item) { Player player = _repository.GetPlayer(playerid).Result; if (player.Level < 3 && item.Type == "Sword") { throw new PlayerLevelException(); } Item newItem = new Item(); newItem.Name = item.Name; newItem.Type = item.Type; newItem.Id = Guid.NewGuid(); newItem.CreationTime = item.CreationDate; return(_repository.CreateItem(playerid, newItem)); }
public Task <Item> Create(Guid playerid, [FromBody] NewItem item) { return(_processor.Create(playerid, item)); }