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

            using (_dbContext)
            {
                var entity = _dbContext.Tourism.FirstOrDefault(x => x.TourismUuid == model.TourismUuid);
                if (entity == null)
                {
                    response.SetFailed("不存在");
                    return(Ok(response));
                }
                if (_dbContext.Tourism.Count(x => x.Name == model.Name && x.TourismUuid != model.TourismUuid) > 0)
                {
                    response.SetFailed("景区名称已存在");
                    return(Ok(response));
                }
                entity.Name        = model.Name;
                entity.SpotContent = model.SpotContent;
                entity.Address     = model.Address;
                entity.Picture     = model.Picture;
                entity.Video       = model.Video;
                entity.Audio       = model.Audio;
                entity.OrderBy     = model.OrderBy;
                entity.State       = model.State;
                int res = _dbContext.SaveChanges();
                if (res > 0)
                {
                    ToLog.AddLog("编辑", "成功:编辑:景区管理列表数据", _dbContext);
                }
                response = ResponseModelFactory.CreateInstance;
                return(Ok(response));
            }
        }
        public IActionResult Create(ScenicSpotViewModel model)
        {
            var response = ResponseModelFactory.CreateInstance;

            using (_dbContext)
            {
                if (_dbContext.Tourism.Count(x => x.Name == model.Name) > 0)
                {
                    response.SetFailed("景区名称已存在");
                    return(Ok(response));
                }

                //var entity = _mapper.Map<ScenicSpotViewModel, HaiKanTravelManagementSystem.Api.Entities.Tourism>(model);
                var entity = new HaiKanTravelManagementSystem.Api.Entities.Tourism();
                entity.Name        = model.Name;
                entity.SpotContent = model.SpotContent;
                entity.Address     = model.Address;
                entity.Picture     = model.Picture;
                entity.Video       = model.Video;
                entity.Audio       = model.Audio;
                entity.OrderBy     = model.OrderBy;
                entity.State       = model.State;
                entity.TourismUuid = Guid.NewGuid();
                entity.IsDelete    = 0;
                _dbContext.Tourism.Add(entity);
                int res = _dbContext.SaveChanges();
                if (res > 0)
                {
                    ToLog.AddLog("添加", "成功:添加:景区管理列表数据", _dbContext);
                }
                response.SetSuccess();
                return(Ok(response));
            }
        }
        public IActionResult Create(ScenicSpotViewModel model)
        {
            var response = ResponseModelFactory.CreateInstance;

            using (_dbContext)
            {
                if (_dbContext.ScenicSpot.Count(x => x.Name == model.Name) > 0)
                {
                    response.SetFailed("景点名称已存在");
                    return(Ok(response));
                }
                var entity = _mapper.Map <ScenicSpotViewModel, ScenicSpot>(model);
                entity.ScenicSpotUuid = Guid.NewGuid();
                entity.IsDelete       = 0;
                _dbContext.ScenicSpot.Add(entity);
                int res = _dbContext.SaveChanges();
                if (res > 0)
                {
                    ToLog.AddLog("添加", "成功:添加:景点介绍管理列表数据", _dbContext);
                }
                response.SetSuccess();
                return(Ok(response));
            }
        }