Ejemplo n.º 1
0
        public async Task InvokeAsync(HttpContext context, ITimeHolder timeholder)
        {
            var currentTime = DateTimeOffset.UtcNow;

            if (currentTime.Hour > 8 && currentTime.Hour < 16)
            {
                timeholder.Memorize(currentTime);

                BeforeGoingToNextMiddleware(context);

                await _next.Invoke(context);

                ReturningFromNextMiddleware(context);
            }
        }