Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

MessageDelayPeriodExtensions.cs

namespace Nop.Core.Domain.Messages;

/// 
/// MessageDelayPeriod Extensions
/// 
public static class MessageDelayPeriodExtensions
{
    /// 
    /// Returns message delay in hours
    /// 
    /// Message delay period
    /// Value of delay send
    /// Value of message delay in hours
    public static int ToHours(this MessageDelayPeriod period, int value)
    {
        return period switch
        {
            MessageDelayPeriod.Hours => value,
            MessageDelayPeriod.Days => value * 24,
            _ => throw new ArgumentOutOfRangeException(nameof(period)),
        };
    }
}