public ActionResult LogList(GridCommand command, LogListModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSystemLog)) return AccessDeniedView(); DateTime? createdOnFromValue = (model.CreatedOnFrom == null) ? null : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.CreatedOnFrom.Value, _dateTimeHelper.CurrentTimeZone); DateTime? createdToFromValue = (model.CreatedOnTo == null) ? null : (DateTime?)_dateTimeHelper.ConvertToUtcTime(model.CreatedOnTo.Value, _dateTimeHelper.CurrentTimeZone).AddDays(1); LogLevel? logLevel = model.LogLevelId > 0 ? (LogLevel?)(model.LogLevelId) : null; var logItems = _logger.GetAllLogs(createdOnFromValue, createdToFromValue, model.Message, logLevel, command.Page - 1, command.PageSize); var gridModel = new GridModel<LogModel> { Data = logItems.Select(x => { return new LogModel() { Id = x.Id, LogLevel = x.LogLevel.GetLocalizedEnum(_localizationService, _currentActivity), ShortMessage = x.ShortMessage, FullMessage = x.FullMessage, IpAddress = x.IpAddress, AccountId = x.AccountId, AccountEmail = x.Account != null ? x.Account.Email : null, PageUrl = x.PageUrl, ReferrerUrl = x.ReferrerUrl, CreatedOn = _dateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc) }; }), Total = logItems.TotalCount }; return new JsonResult { Data = gridModel }; }
public ActionResult List() { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSystemLog)) return AccessDeniedView(); var model = new LogListModel(); model.AvailableLogLevels = LogLevel.Debug.ToSelectList(false).ToList(); model.AvailableLogLevels.Insert(0, new SelectListItem() { Text = "Tất cả", Value = "0" }); return View(model); }