public IActionResult ListActivityLog(DataSourceRequest command, string manufacturerId) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageManufacturers)) { return(Content("")); } var activityLog = _customerActivityService.GetManufacturerActivities(null, null, manufacturerId, command.Page - 1, command.PageSize); var gridModel = new DataSourceResult { Data = activityLog.Select(x => { var customer = _customerService.GetCustomerById(x.CustomerId); var m = new ManufacturerModel.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 <ManufacturerModel.ActivityLogModel> activityLogModels, int totalCount) PrepareActivityLogModel(string manufacturerId, int pageIndex, int pageSize) { var activityLog = _customerActivityService.GetManufacturerActivities(null, null, manufacturerId, pageIndex - 1, pageSize); return(activityLog.Select(x => { var customer = _customerService.GetCustomerById(x.CustomerId); var m = new ManufacturerModel.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 <ManufacturerModel.ActivityLogModel> activityLogModels, int totalCount)> PrepareActivityLogModel(string manufacturerId, int pageIndex, int pageSize) { var activityLog = await _customerActivityService.GetManufacturerActivities(null, null, manufacturerId, pageIndex - 1, pageSize); var items = new List <ManufacturerModel.ActivityLogModel>(); foreach (var x in activityLog) { var customer = await _customerService.GetCustomerById(x.CustomerId); var m = new ManufacturerModel.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); }
public ActionResult ListActivityLog(DataSourceRequest command, int manufacturerId) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageManufacturers)) return Content(""); var activityLog = _customerActivityService.GetManufacturerActivities(null, null, manufacturerId, command.Page - 1, command.PageSize); var gridModel = new DataSourceResult { Data = activityLog.Select(x => { var customer = _customerService.GetCustomerById(x.CustomerId); var m = new ManufacturerModel.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); }