/// <summary>
        /// 通过id获取监测阵列的类型
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult GetOneMonitorPointInfo(int id = 13)
        {
            MonitorPointInfo newMoitor = monitorPointInfoService.Get(a => a.MonitorId == id).First();

            string getMonitorType = newMoitor.Type.Length > 0 ? newMoitor.Type : "错误,未知";

            return(Content(getMonitorType));
        }
Esempio n. 2
0
        public void Add()
        {
            MonitorPointInfoService monitorPointInfoService = new MonitorPointInfoService();

            MonitorPointInfo monitorPointInfo = new MonitorPointInfo();;

            monitorPointInfo.MonitorId = 1;
            monitorPointInfo.Name      = "大树";
            monitorPointInfo.Type      = "泥石流";
            monitorPointInfoService.Add(monitorPointInfo);
            Console.WriteLine("添加成功");
        }
        /// <summary>
        /// 录入monitorInfo信息
        /// </summary>
        /// <param name="deviceInfo"></param>
        /// <returns></returns>
        public ActionResult EnteringMonitorPointInfo(MonitorPointInfo monitorPointInfo)
        {
            var res = new JsonResult();

            try
            {
                monitorPointInfoService.Add(monitorPointInfo);
                res.Data = new { state = true };
            }
            catch (Exception e)
            {
                res.Data = new { state = false };
            }

            return(res);
        }