Exemplo n.º 1
0
        public ActionResult Edit(Guid componentId)
        {
            var repository = CurrentAccountDbContext.GetLogConfigRepository();
            var config     = repository.GetByComponentId(componentId);

            var model = new EditLogModel
            {
                Id               = componentId,
                IsFatalEnabled   = config.IsFatalEnabled,
                IsErrorEnabled   = config.IsErrorEnabled,
                IsWarningEnabled = config.IsWarningEnabled,
                IsInfoEnabled    = config.IsInfoEnabled,
                IsDebugEnabled   = config.IsDebugEnabled,
                IsTraceEnabled   = config.IsTraceEnabled,
                ComponentName    = config.Component.DisplayName
            };

            return(PartialView(model));
        }
Exemplo n.º 2
0
        public ActionResult Edit(EditLogModel model)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView(model));
            }

            var repository = CurrentAccountDbContext.GetLogConfigRepository();
            var config     = repository.GetByComponentId(model.Id);

            model.ComponentName     = config.Component.DisplayName;
            config.IsFatalEnabled   = model.IsFatalEnabled;
            config.IsErrorEnabled   = model.IsErrorEnabled;
            config.IsWarningEnabled = model.IsWarningEnabled;
            config.IsInfoEnabled    = model.IsInfoEnabled;
            config.IsDebugEnabled   = model.IsDebugEnabled;
            config.IsTraceEnabled   = model.IsTraceEnabled;
            config.LastUpdateDate   = Now();
            CurrentAccountDbContext.SaveChanges();

            return(GetSuccessJsonResponse());
        }