コード例 #1
0
        /// <summary>
        /// Deletes all products.
        /// </summary>
        /// <param name="patternManager">The pattern manager.</param>
        public static void DeleteAll(this IPatternManager patternManager)
        {
            Guard.NotNull(() => patternManager, patternManager);

            var productsToDelete = patternManager.Products.ToList();

            foreach (var product in productsToDelete)
            {
                patternManager.DeleteProduct(product);
            }
        }
コード例 #2
0
        /// <summary>
        /// Deletes the pattern by name.
        /// </summary>
        /// <param name="manager">The pattern manager.</param>
        /// <param name="name">The pattern name.</param>
        public static bool Delete(this IPatternManager manager, string name)
        {
            Guard.NotNull(() => manager, manager);
            Guard.NotNullOrEmpty(() => name, name);

            var product = manager.Find(name);

            if (product == null)
            {
                return(false);
            }

            return(manager.DeleteProduct(product));
        }