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 ActionResult List() { var models = new List <ScheduleTaskModel>(); var tasks = _scheduleTaskService.GetAllTasks(true); var lastHistoryEntries = _scheduleTaskService.GetHistoryEntries(0, int.MaxValue, 0, true, true).ToDictionarySafe(x => x.ScheduleTaskId); foreach (var task in tasks.Where(x => x.IsVisible())) { lastHistoryEntries.TryGetValue(task.Id, out var lastEntry); var model = _adminModelHelper.CreateScheduleTaskModel(task, lastEntry); if (model != null) { models.Add(model); } } return(View(models)); }