using Microsoft.AspNetCore.Mvc.Filters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace FilterSamples.Filters
{
    public class AsyncSyncSampleActionFilter : IActionFilter, IAsyncActionFilter
    {
        public void OnActionExecuted(ActionExecutedContext context)
        {
            
        }

        public void OnActionExecuting(ActionExecutingContext context)
        {
            
        }

        public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            DateTime dateTime = DateTime.Now;

            await next();

            double time = DateTime.Now.Subtract(dateTime).TotalMilliseconds;
        }
    }
}
