private void Log(ActionExecutedContext context)
        {
            //TODO Eliminar cuando se resuelva injección de Filtros
            IApplicationContext appContext =
                new XmlApplicationContext(context.HttpContext.Server.MapPath(@"~/Config/service.xml"),
                    context.HttpContext.Server.MapPath(@"~/Config/repository.xml"),
                    context.HttpContext.Server.MapPath(@"~/Config/aop.xml"));
            UsuarioService = (IUsuarioService)appContext.GetObject("UsuarioService");
            SystemLogService = (ISystemLogService)appContext.GetObject("SystemLogService");
            //

            string username = context.RequestContext.HttpContext.User.Identity.Name;
            Usuario usuario = UsuarioService.ReadUsuarioByUsername(username).FirstOrDefault();

            SystemLog log = new SystemLog();
            log.UsuarioId = usuario.Id;
            log.Date = DateTime.Now;
            log.Modulo = context.RequestContext.RouteData.Values["controller"].ToString();
            log.Accion = context.RequestContext.RouteData.Values["action"].ToString();
            SystemLogService.CreateLog(log);
        }
Exemple #2
0
 public LogViewModel(SystemLog systemLog, IEnumerable<Usuario> usuarios)
 {
     SystemLog = systemLog;
     Usuarios = usuarios;
 }
Exemple #3
0
 public LogViewModel(SystemLog systemLog)
 {
     SystemLog = systemLog;
 }
 public void UpdateLog(SystemLog log)
 {
     SystemLogRepository.UpdateLog(log);
 }
 public void DeleteLog(SystemLog log)
 {
     SystemLogRepository.DeleteLog(log);
 }
 public void CreateLog(SystemLog log)
 {
     SystemLogRepository.CreateLog(log);
 }