Exemplo n.º 1
0
        protected ValueTask <T> ConvertModelToLocalTimeBase <T>(T model) where T : class
        {
            if (!ConvertToLocalTime)
            {
                return(ValueTask.FromResult(model));
            }

            if (ConvertToLocalTime && TimeZoneService == null)
            {
                throw new Exception($"{nameof(TimeZoneService)} must be set in constructor of derived class if you want to {nameof(ConvertModelToLocalTimeBase)}.");
            }

            if (TimeZoneService == null)
            {
                return(ValueTask.FromResult(model));
            }

            return(TimeZoneService.ConvertModelToLocalTime(model));
        }