//public ActionResult SaveChanges([Bind("Name", "ArmingCode", "Host", "Port", "User", "Password")] AlarmSystemInfo alarmInfo)
        public ActionResult SaveChanges(AlarmSystemInfo alarmInfo)
        {
            if (ModelState.IsValid)
            {
                myAlarmSystem.Name = alarmInfo.Name;
                myAlarmSystem.ArmingCode = alarmInfo.ArmingCode;

                myAlarmSystem.Host = alarmInfo.Host;
                myAlarmSystem.Port = alarmInfo.Port;
                myAlarmSystem.User = alarmInfo.User;
                if (!String.IsNullOrEmpty(alarmInfo.Password))
                    myAlarmSystem.Password = alarmInfo.Password;

                myAlarmSystem.j64Server = alarmInfo.j64Host;
                myAlarmSystem.j64Port = alarmInfo.j64Port;

                for (int i = 0; i < Request.Form["partition.Id"].Count; i++)
                {
                    var partition = myAlarmSystem.PartitionList.Find(p => p.Id.ToString() == Request.Form["partition.Id"][i]);

                    partition.Name = Request.Form["partition.Name"][i];
                }

                for (int i = 0; i < Request.Form["zone.Id"].Count; i++)
                {
                    var zone = myAlarmSystem.ZoneList.Find(p => p.Id.ToString() == Request.Form["zone.Id"][i]);

                    zone.Name = Request.Form["zone.Name"][i];
                    zone.ZoneType = (ZoneType)Enum.Parse(typeof(ZoneType), Request.Form["zone.ZoneType"][i]);
                }

                AlarmSystemRepository.Save(myAlarmSystem);

                // this will update the existing devices on the smartthings hub
                SmartThingsRepository.InstallDevices(this.Request.Host.Value);

                // Add the partition/zone info to the alarm model we are returning
                alarmInfo = new AlarmSystemInfo(myAlarmSystem);
            }

            return View("index", alarmInfo);
        }
 public IActionResult Index()
 {
     var asi = new AlarmSystemInfo(myAlarmSystem);
     //asi.Password = null;
     return View(asi);
 }