public IActionResult Edit(smokeInductionViewModel model)
        {
            var response = ResponseModelFactory.CreateInstance;

            using (_dbContext)
            {
                var entity = _dbContext.SmokeGan.FirstOrDefault(x => x.SmokeGanUuid == model.SmokeGanUuid);
                if (entity == null)
                {
                    response.SetFailed("不存在");
                    return(Ok(response));
                }
                if (_dbContext.SmokeGan.Count(x => x.SmokeGanShebei == model.SmokeGanShebei && x.SmokeGanUuid != model.SmokeGanUuid) > 0)
                {
                    response.SetFailed("名称已存在");
                    return(Ok(response));
                }
                entity.SmokeGanShebei = model.SmokeGanShebei;
                entity.SmokeGanStaues = model.SmokeGanStaues;
                entity.SmokeGanBaojin = model.SmokeGanBaojin;
                entity.Lon            = model.Lon;
                entity.Lat            = model.Lat;
                int res = _dbContext.SaveChanges();
                if (res > 0)
                {
                    ToLog.AddLog("编辑", "成功:编辑:烟感信息一条数据", _dbContext);
                }
                response = ResponseModelFactory.CreateInstance;
                return(Ok(response));
            }
        }
        public IActionResult Create(smokeInductionViewModel model)
        {
            var response = ResponseModelFactory.CreateInstance;

            using (_dbContext)
            {
                if (_dbContext.SmokeGan.Count(x => x.SmokeGanShebei == model.SmokeGanShebei) > 0)
                {
                    response.SetFailed("设备已存在");
                    return(Ok(response));
                }

                var entity = _mapper.Map <smokeInductionViewModel, SmokeGan>(model);
                entity.SmokeGanUuid = Guid.NewGuid();
                entity.IsDeleted    = 0;
                entity.AddTime      = DateTime.Now.ToString("yyyy-MM-dd");
                entity.AddPeople    = AuthContextService.CurrentUser.DisplayName;


                _dbContext.SmokeGan.Add(entity);
                int res = _dbContext.SaveChanges();
                if (res > 0)
                {
                    ToLog.AddLog("添加", "成功:添加:烟感信息一条数据", _dbContext);
                }
                response.SetSuccess();
                return(Ok(response));
            }
        }