Beispiel #1
0
        public ActionResult IndexScheduleTask(IndexViewModel ivm)
        {
            var formData = ControllerContext.RequestContext.HttpContext.Request.Form;
            List <ScheduledTaskViewModel> vmsForTasks = _scheduledTaskService.GetTaskViewModelsFromForm(formData);

            _scheduledTaskService.UpdateRecords(vmsForTasks);
            //get the vm for the task we are trying to schedule
            ScheduledTaskViewModel vmToSchedule = vmsForTasks.Where(vm => vm.Scheduling).FirstOrDefault();

            if (vmToSchedule != null)
            {
                _scheduledTaskService.ScheduleTask(vmToSchedule);
            }

            return(RedirectToAction("Index"));
        }