public ActionResult ListActivityLog(DataSourceRequest command, int categoryId) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageCategories)) { return(Content("")); } var activityLog = _customerActivityService.GetCategoryActivities(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 CategoryModel.ActivityLogModel { Id = x.Id, ActivityLogTypeName = x.ActivityLogType.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 <CategoryModel.ActivityLogModel> activityLogModel, int totalCount) PrepareActivityLogModel(string categoryId, int pageIndex, int pageSize) { var activityLog = _customerActivityService.GetCategoryActivities(null, null, categoryId, pageIndex - 1, pageSize); return(activityLog.Select(x => { var customer = _customerService.GetCustomerById(x.CustomerId); var m = new CategoryModel.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 <CategoryModel.ActivityLogModel> activityLogModel, int totalCount)> PrepareActivityLogModel(string categoryId, int pageIndex, int pageSize) { var activityLog = await _customerActivityService.GetCategoryActivities(null, null, categoryId, pageIndex - 1, pageSize); var activityLogModelList = new List <CategoryModel.ActivityLogModel>(); foreach (var item in activityLog) { var customer = await _customerService.GetCustomerById(item.CustomerId); var m = new CategoryModel.ActivityLogModel { Id = item.Id, ActivityLogTypeName = (await _customerActivityService.GetActivityTypeById(item.ActivityLogTypeId))?.Name, Comment = item.Comment, CreatedOn = _dateTimeHelper.ConvertToUserTime(item.CreatedOnUtc, DateTimeKind.Utc), CustomerId = item.CustomerId, CustomerEmail = customer != null ? customer.Email : "null" }; activityLogModelList.Add(m); } return(activityLogModelList, activityLog.TotalCount); }
public ActionResult ListActivityLog(DataSourceRequest command, int categoryId) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageCategories)) return Content(""); var activityLog = _customerActivityService.GetCategoryActivities(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 CategoryModel.ActivityLogModel { Id = x.Id, ActivityLogTypeName = x.ActivityLogType.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); }