コード例 #1
0
        public static void Log(ControllerContext context, User user, CatrinaContext db)

        {
            string actionName     = context.RouteData.Values["action"].ToString();
            string controllerName = context.RouteData.Values["controller"].ToString();

            var date = DateTime.Now;

            var log = new Log()
            {
                User            = user,
                ActionName      = actionName,
                ConctrollerName = controllerName,
                Act             = ActionType.justLog.ToString(),
                Date            = date
            };

            db.Logs.AddAsync(log);
            db.SaveChangesAsync();
        }