public async Task <Item> CreateItem(NewItem newItem)
 {
     //Item item = new Item();
     //item.Id = Guid.NewGuid();
     //tem.Name = newItem.Name;
     //item.Price = newItem.Price;
     //item.ItemType = newItem.ItemType;
     //item.CreationDate = DateTime.Today; // get time
     return(await _itemsProcessor.CreateItem(newItem));
 }
        public async Task <Item> UpdateItem(Guid id, NewItem newItem)
        {
            var item = new Item()
            {
                Id       = Guid.NewGuid(),
                OwnerId  = newItem.OwnerId,
                Name     = newItem.Name,
                Price    = newItem.Price,
                ItemType = newItem.ItemType
            };
            await _repository.UpdateItem(id, newItem);

            return(item);
        }
        public async Task <Item> CreateItem(NewItem newItem)
        {
            var player = await _repository.Get(newItem.OwnerId);

            if (player.Level < 3 && newItem.ItemType == ItemTypes.Sword)
            {
                throw new TooLowLevelException();
            }
            var item = new Item()
            {
                Id           = Guid.NewGuid(),
                OwnerId      = newItem.OwnerId,
                Name         = newItem.Name,
                Price        = newItem.Price,
                ItemType     = newItem.ItemType,
                CreationDate = DateTime.Today
            };
            await _repository.CreateItem(item);

            return(item);
        }
 public async Task <Item> UpdateItem(string itemId, NewItem item)
 {
     return(await _itemsProcessor.UpdateItem(new Guid(itemId), item));
 }