// GET: Monitor/Edit/5
        public ActionResult Edit(Guid id)
        {
            var monitor    = _monitorRepository.GetById(id);
            var messengers = _messengerRepository.List();

            var viewModel = new MonitorViewModel()
            {
                Id                 = id,
                Name               = monitor.Name,
                Enabled            = monitor.Enabled,
                Messengers         = messengers,
                SelectedMessengers = monitor.Messengers
            };

            return(View(viewModel));
        }
        public void RunMonitor()
        {
            var rep = new MonitorRepository();

            var monitor      = rep.GetById(new Guid("EAA1468C-1CA8-4CC9-A726-A8B700A345FE"));
            var monitorToRun = rep.GetByName(monitor.Name);

            monitorToRun.Run(monitor.Messengers);
        }
Esempio n. 3
0
        static int Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("Please enter a valid Monitor Id");
                return(1);
            }
            var monitorRepository = new MonitorRepository();

            var monitor      = monitorRepository.GetById(new Guid(args[0]));
            var monitorToRun = monitorRepository.GetByName(monitor.Name);


            try
            {
                monitorToRun.Run(monitor.Messengers);

                return(0);
            }
            catch (Exception)
            {
                return(1);
            }
        }