LevelHelper.cs 1.13 KB
using HHECS.BllModel;

namespace HHECS.Infrastructure.Enums
{
    public static class LevelHelper
    {
        public static BllResultCode ToBllResultCode(this Level level)
        {
            return level switch
            {
                Level.Info => BllResultCode.Info,
                Level.Success => BllResultCode.Success,
                Level.Error => BllResultCode.Error,
                Level.Warning => BllResultCode.Warning,
                Level.Exception => BllResultCode.Exception,
                Level.Failure => BllResultCode.Failure,
                _ => BllResultCode.Info
            };
        }

        public static Level ToLevel(BllResultCode bllResultCode)
        {
            return bllResultCode switch
            {
                BllResultCode.Info => Level.Info,
                BllResultCode.Success => Level.Success,
                BllResultCode.Error => Level.Error,
                BllResultCode.Warning => Level.Warning,
                BllResultCode.Exception => Level.Exception,
                BllResultCode.Failure => Level.Failure,
                _ => Level.Info
            };
        }
    }
}