Exemple #1
0
        public ActionResult GetMarkerShare(string id)
        {
            ReturnObject2 ro = null;

            try
            {
                if (!string.IsNullOrEmpty(id))
                {
                    MarkerShare markerShareNew = _efDbContext.MarkerShare.Find(id);
                    if (markerShareNew != null)
                    {
                        ro = new ReturnObject2();
                        ro.Data.Add("MarkerShare", markerShareNew);
                    }
                    else
                    {
                        throw new Exception("未找到标注或标注已过期!");
                    }
                }
                else
                {
                    throw new Exception("未找到标注或标注已过期!");
                }
            }
            catch (Exception ex)
            {
                ro = new ReturnObject2(ex.Message);
            }

            return(Json(ro));
        }
Exemple #2
0
        public ActionResult CreateMarkerShare(MarkerShare markerShare)
        {
            ReturnObject2 ro = null;

            try
            {
                if (markerShare != null && !string.IsNullOrEmpty(markerShare.GeoJSON))
                {
                    MarkerShare markerShareNew = new MarkerShare();
                    markerShareNew.Title   = markerShare.Title;
                    markerShareNew.Content = markerShare.Content;
                    markerShareNew.GeoJSON = markerShare.GeoJSON;

                    markerShareNew = _efDbContext.MarkerShare.Add(markerShareNew);
                    _efDbContext.SaveChanges();

                    ro = new ReturnObject2();
                    ro.Data.Add("MarkerShare", markerShareNew);
                }
                else
                {
                    throw new Exception("标注或标注图形缺失");
                }
            }
            catch (Exception ex)
            {
                ro = new ReturnObject2(ex.Message);
            }

            return(Json(ro));
        }