示例#1
0
 public ActionResult SetSelectedTank(SelectTankModel stm)
 {
     WaterSensorController.CurrentAquariumName = stm.SelectedTank.Text;
     //var tanks = Settings.Get().AquariumNames;
     //var slis = tanks.ToSelectListItems();
     //var stm = new SelectTankModel { Tanks = slis };
     return(PartialView("_SelectTank", stm));
 }
示例#2
0
        public ActionResult _SelectTank()
        {
            var tanks        = Settings.Get().AquariumNames;
            var selectedtank = tanks.Find(x => x.Name == WaterSensorController.CurrentAquariumName);
            var st           = selectedtank.ToSelectListItem();
            var slis         = tanks.ToSelectListItems();

            foreach (var tank in slis)
            {
                if (tank.Value == st.Value)
                {
                    tank.Selected = true;
                    break;
                }
            }
            var stm = new SelectTankModel {
                Tanks = slis, SelectedTank = st
            };

            return(PartialView("_SelectTank", stm));
        }