public ActionResult List() { if (!Services.Permissions.Authorize(StandardPermissionProvider.ManageImports)) { return(AccessDeniedView()); } var model = new ImportProfileListModel { Profiles = new List <ImportProfileModel>(), AvailableEntityTypes = ImportEntityType.Product.ToSelectList(false).ToList() }; var profiles = _importProfileService.GetImportProfiles().ToList(); foreach (var profile in profiles) { var profileModel = new ImportProfileModel(); PrepareProfileModel(profileModel, profile, false); profileModel.TaskModel = profile.ScheduleTask.ToScheduleTaskModel(Services.Localization, _dateTimeHelper, Url); model.Profiles.Add(profileModel); } return(View(model)); }
public ActionResult List() { var model = new ImportProfileListModel { Profiles = new List <ImportProfileModel>(), AvailableEntityTypes = ImportEntityType.Product.ToSelectList(false).ToList() }; var lastHistoryEntries = _scheduleTaskService.GetHistoryEntries(0, int.MaxValue, 0, true, true).ToDictionarySafe(x => x.ScheduleTaskId); var profiles = _importProfileService.GetImportProfiles().ToList(); foreach (var profile in profiles) { var profileModel = new ImportProfileModel(); lastHistoryEntries.TryGetValue(profile.SchedulingTaskId, out var lastHistoryEntry); PrepareProfileModel(profileModel, profile, lastHistoryEntry, false); profileModel.TaskModel = _adminModelHelper.CreateScheduleTaskModel(profile.ScheduleTask, lastHistoryEntry) ?? new ScheduleTaskModel(); model.Profiles.Add(profileModel); } return(View(model)); }
public async Task <IActionResult> List() { var model = new ImportProfileListModel(); var lastExecutionInfos = (await _taskStore.GetExecutionInfoQuery(false) .ApplyCurrentMachineNameFilter() .ApplyTaskFilter(0, true) .ToListAsync()) .ToDictionarySafe(x => x.TaskDescriptorId); var profiles = await _db.ImportProfiles .Include(x => x.Task) .AsNoTracking() .OrderBy(x => x.EntityTypeId) .ThenBy(x => x.Name) .ToListAsync(); foreach (var profile in profiles) { var profileModel = new ImportProfileModel(); lastExecutionInfos.TryGetValue(profile.TaskId, out var lastExecutionInfo); await PrepareProfileModel(profileModel, profile, lastExecutionInfo, false); profileModel.TaskModel = await profile.Task.MapAsync(lastExecutionInfo); model.Profiles.Add(profileModel); } return(View(model)); }
public ActionResult List() { if (!Services.Permissions.Authorize(StandardPermissionProvider.ManageImports)) return AccessDeniedView(); var model = new ImportProfileListModel { Profiles = new List<ImportProfileModel>(), AvailableEntityTypes = ImportEntityType.Product.ToSelectList(false).ToList() }; var profiles = _importProfileService.GetImportProfiles().ToList(); foreach (var profile in profiles) { var profileModel = new ImportProfileModel(); PrepareProfileModel(profileModel, profile, false); profileModel.TaskModel = profile.ScheduleTask.ToScheduleTaskModel(Services.Localization, _dateTimeHelper, Url); model.Profiles.Add(profileModel); } return View(model); }