示例#1
0
        public string SavePoi(PoiDto input)
        {
            //查询name
            var poi = _baiyecontext.POIs.Where(p => p.name == input.name).FirstOrDefault();

            if (poi == null)
            {
                poi = new POI();
            }
            //转换百度地址为GPS
            var regps = _locheper.Convert2GPS(input.gpslat, input.gpslng);

            poi.id       = new IdWorker(1, 1).NextId();
            poi.name     = input.name;
            poi.samename = input.samename;
            poi.content  = input.content;
            poi.gpslat   = regps[0];
            poi.gpslng   = regps[1];
            _baiyecontext.POIs.Add(poi);
            _baiyecontext.SaveChanges();
            return("OK");
        }