/// <summary> /// Renames a product. /// </summary> /// <param name="id">Product's key.</param> /// <param name="newName">New name for a product.</param> public void RenameProduct(int id, string newName) { ValidatorClass.CheckProductById(id); ValidatorClass.StringValidator(newName); Storage.products[id].Name = newName; }
/// <summary> /// Changes the price of a specific item in the product storage. /// </summary> /// <param name="id">Product's key.</param> /// <param name="price">Product's new price.</param> public void ChangePrice(int id, decimal newPrice) { ValidatorClass.CheckProductById(id); ValidatorClass.PriceValidator(newPrice); Storage.products[id].Price = newPrice; }
/// <summary> /// Deletes an item from the product storage. /// </summary> /// <param name="id">Product's key.</param> public void DeleteProduct(int id) { ValidatorClass.CheckProductById(id); Storage.products.Remove(id); }