public async Task UpdateInventory(Inventory command, CancellationToken token)
        {
            var target = await GetInventoryById(command.Id, token).ConfigureAwait(false);

            target.Name       = command.Name.Trim().ToUpperInvariant();
            target.SupplyDate = command.SupplyDate;

            _db.Entry(target).State = EntityState.Modified;
        }
        public async Task <IActionResult> PutInventory(int id, Inventory inventory)
        {
            if (id != inventory.Id)
            {
                return(BadRequest());
            }

            _context.Entry(inventory).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!InventoryExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task UpdateProductAsync(Product command, CancellationToken token)
        {
            var target = await _set.Include(x => x.ProductShelf)
                         .SingleOrDefaultAsync(x => x.Id == command.Id, token);

            if (target is null)
            {
                throw new ArgumentException("The Id given doesn't identify any object in persistence!");
            }
            target.Brand       = command.Brand?.Trim().ToUpper();
            target.Name        = command.Name.Trim().ToUpper();
            target.Quantity    = command.Quantity;
            target.RetailPrice = command.RetailPrice;
            target.CostPrice   = command.CostPrice;
            target.UnitMeasure = command.UnitMeasure;
            target.SupplyDate  = command.SupplyDate;
            target.ShelfId     = command.ShelfId;
            target.Comments    = command.Comments;

            _db.Entry(target).State = EntityState.Modified;
        }