Exemple #1
0
 public void AddArea(EArea area, EnumMapCoordinates coordinates)
 {
     switch (coordinates)
     {
         case EnumMapCoordinates.Gcj02:
             area.AreaPoints = _mapService.Gcj02ToWgs84(area.AreaPoints.ToObject<IList<EMapPoint>>().ToArray()).ToJson();
             break;
         default:
             break;
     }
     _rep.Add(area);
 }
Exemple #2
0
 public void SaveArea(EArea area, EnumMapCoordinates coordinates)
 {
     switch (coordinates)
     {
         case EnumMapCoordinates.Gcj02:
             area.AreaPoints = _mapService.Gcj02ToWgs84(area.AreaPoints.ToObject<IList<EMapPoint>>().ToArray()).ToJson();
             break;
         default:
             break;
     }
     _rep.Save(area, p => p.Id == area.Id);
     _cacheService.UpdateCacheDependent(CacheKey.Gps_Area_By_Id.GetFormat(area.Id));
 }
 /// <summary>
 /// 编辑
 /// </summary>
 /// <returns></returns>
 public ActionResult EditArea(EArea area, EnumMapCoordinates coordinates)
 {
     if (area.Id == 0)
     {
         area.UserId = Passport.User.Id;
         _areaService.AddArea(area, coordinates);
         return JsonResult(area, "添加成功!");
     }
     else
     {
         area.UserId = Passport.User.Id;
         _areaService.SaveArea(area, coordinates);
         return JsonResult(area, "保存成功!");
     }
 }