public IActionResult ListCategoryActivityLog(DataSourceRequest command, string categoryId) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageKnowledgebase)) { return(Content("")); } var activityLog = _customerActivityService.GetKnowledgebaseCategoryActivities(null, null, categoryId, command.Page - 1, command.PageSize); var gridModel = new DataSourceResult { Data = activityLog.Select(x => { var customer = _customerService.GetCustomerById(x.CustomerId); var m = new KnowledgebaseCategoryModel.ActivityLogModel { Id = x.Id, ActivityLogTypeName = _customerActivityService.GetActivityTypeById(x.ActivityLogTypeId)?.Name, Comment = x.Comment, CreatedOn = _dateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc), CustomerId = x.CustomerId, CustomerEmail = customer != null ? customer.Email : "null" }; return(m); }), Total = activityLog.TotalCount }; return(Json(gridModel)); }
public virtual (IEnumerable <KnowledgebaseCategoryModel.ActivityLogModel> activityLogModels, int totalCount) PrepareCategoryActivityLogModels(string categoryId, int pageIndex, int pageSize) { var activityLog = _customerActivityService.GetKnowledgebaseCategoryActivities(null, null, categoryId, pageIndex - 1, pageSize); return(activityLog.Select(x => { var customer = _customerService.GetCustomerById(x.CustomerId); var m = new KnowledgebaseCategoryModel.ActivityLogModel { Id = x.Id, ActivityLogTypeName = _customerActivityService.GetActivityTypeById(x.ActivityLogTypeId)?.Name, Comment = x.Comment, CreatedOn = _dateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc), CustomerId = x.CustomerId, CustomerEmail = customer != null ? customer.Email : "null" }; return m; }), activityLog.TotalCount); }
public virtual async Task <(IEnumerable <KnowledgebaseCategoryModel.ActivityLogModel> activityLogModels, int totalCount)> PrepareCategoryActivityLogModels(string categoryId, int pageIndex, int pageSize) { var activityLog = await _customerActivityService.GetKnowledgebaseCategoryActivities(null, null, categoryId, pageIndex - 1, pageSize); var items = new List <KnowledgebaseCategoryModel.ActivityLogModel>(); foreach (var x in activityLog) { var customer = await _customerService.GetCustomerById(x.CustomerId); var m = new KnowledgebaseCategoryModel.ActivityLogModel { Id = x.Id, ActivityLogTypeName = (await _customerActivityService.GetActivityTypeById(x.ActivityLogTypeId))?.Name, Comment = x.Comment, CreatedOn = _dateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc), CustomerId = x.CustomerId, CustomerEmail = customer != null ? customer.Email : "null" }; items.Add(m); } return(items, activityLog.TotalCount); }