//GET: PowerShell/Schedule/1
        public IActionResult Schedule(int id)
        {
            var script = _scriptRepository.GetScriptById(id);

            if (script == null)
            {
                return(NotFound());
            }
            if (script.Category != null && !UserHasAccessToCategory(script.Category.Id))
            {
                return(RedirectToAction("Index"));
            }

            var scriptParams = _scriptIO.ScriptParams(script.Name) ??
                               new Dictionary <string, string>();

            var scheduleView = new PowerShellSchedule()
            {
                Id        = script.Id,
                Date      = DateTime.Now,
                Recurring = JobServices.RecurringOptions(),
                PSparams  = scriptParams
            };

            return(PartialView(scheduleView));
        }
Esempio n. 2
0
        //GET: PowerShell/Schedule/1
        public ActionResult Schedule(int id)
        {
            var script = _scriptRepository.GetScriptById(id);

            if (script == null)
            {
                return(HttpNotFound());
            }

            var scriptParams = ScriptIO.ScriptParams(script.Name) ??
                               new Dictionary <string, string>();

            var scheduleView = new PowerShellSchedule()
            {
                Id        = script.Id,
                Date      = DateTime.Now,
                Recurring = JobServices.RecurringOptions(),
                PSparams  = scriptParams
            };

            return(PartialView(scheduleView));
        }