Exemplo n.º 1
0
        private void CreateLog(string actionName, string controllerName, Stopwatch executionTime)
        {
            var myLog = new ActionFilterLog();

            myLog.ActionName     = actionName;
            myLog.ControllerName = controllerName;
            myLog.ExecutionTime  = executionTime.ElapsedMilliseconds;
            DbContext.ActionFilterLogs.Add(myLog);
            DbContext.SaveChanges();
        }
Exemplo n.º 2
0
        public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            var myLog = new ActionFilterLog();

            myLog.ActionName = filterContext
                               .ActionDescriptor
                               .ActionName;

            myLog.ControllerName = filterContext
                                   .ActionDescriptor
                                   .ControllerDescriptor
                                   .ControllerName;

            myLog.ExecutionTime = Stopwatch.ElapsedMilliseconds;

            DbContext.ActionFilterLogs.Add(myLog);
            DbContext.SaveChanges();
        }