示例#1
0
        /// <summary>
        /// Adds a new <see cref="DeliveryEventWebhook"/> to the end of the <see cref="ICollection{T}"/> with the given values.
        /// </summary>
        /// <param name="collection">The collection.</param>
        /// <param name="eventName">The name of the event.</param>
        /// <param name="url">The URL to be called when the event occurs.</param>
        public static void Add(this ICollection <DeliveryEventWebhook> collection, string eventName, Uri url)
        {
            Ensure.NotNull(collection, nameof(collection));

            var outcome = DeliveryEventWebhook.Create(eventName, url);

            collection.AddOrThrow(outcome);
        }
        /// <summary>
        /// Adds a new <see cref="DeliveryBookingItem"/> to the end of the <see cref="ICollection{T}"/> with the given values.
        /// </summary>
        /// <param name="collection">The collection.</param>
        /// <param name="description">The description.</param>
        /// <param name="stockKeepingUnit">The stock keeping unit.</param>
        /// <param name="quantity">The quantity.</param>
        /// <param name="price">The price.</param>
        public static void Add(this ICollection <DeliveryBookingItem> collection, string description, string stockKeepingUnit, int quantity, decimal price)
        {
            Ensure.NotNull(collection, nameof(collection));

            var outcome = DeliveryBookingItem.Create(description, stockKeepingUnit, quantity, price);

            collection.AddOrThrow(outcome);
        }
        /// <summary>
        /// Adds a new <see cref="JobConstraint"/> to the end of the <see cref="ICollection{T}"/> with the given values.
        /// </summary>
        /// <param name="collection">The collection.</param>
        /// <param name="name">The name.</param>
        /// <param name="value">The value.</param>
        public static void Add(this ICollection <JobConstraint> collection, string name, string value)
        {
            Ensure.NotNull(collection, nameof(collection));

            var outcome = JobConstraint.Create(name, value);

            collection.AddOrThrow(outcome);
        }