예제 #1
0
        public ActionResult SetWave(int id, string wave)
        {
            IDictionary <int, Device> devicesDictionary = (SortedDictionary <int, Device>)Session["Devices"];
            ISetWave w = (ISetWave)devicesDictionary[id];
            double   currentWave;
            string   temp = wave;

            temp = temp.Replace('.', ',');
            if (Double.TryParse(temp, out currentWave))
            {
                if (currentWave >= 87.5 && currentWave <= 108)
                {
                    w.SetWave(currentWave);
                }
                else
                {
                    TempData["Error"] = "Введите значение от 87.5 до 108!";
                }
            }
            else
            {
                TempData["Error"] = "Введите только цифры!";
            }
            Session["Devices"] = devicesDictionary;
            return(RedirectToAction("Index"));
        }
예제 #2
0
        public ActionResult LessWave(int id)
        {
            IDictionary <int, Device> devicesDictionary = (SortedDictionary <int, Device>)Session["Devices"];
            ISetWave w = (ISetWave)devicesDictionary[id];

            w.LessWave();
            return(RedirectToAction("Index"));
        }