public static void Insert(OrgChartShape shape)
        {
            if (!UpdateDatabase)
            {
                var first = All().OrderByDescending(e => e.Id).FirstOrDefault();

                var id = 0;

                if (first != null)
                {
                    id = first.Id;
                }

                shape.Id = id + 1;

                All().Insert(0, shape);
            }
            else
            {
                using (var db = new SampleEntities())
                {
                    db.OrgChartShapes.AddObject(shape);
                    db.SaveChanges();
                }
            }
        }
        public static void Update(OrgChartShape shape)
        {
            if (!UpdateDatabase)
            {
                var target = One(e => e.Id == shape.Id);

                if (target != null)
                {
                    target.JobTitle = shape.JobTitle;
                    target.Color = shape.Color;
                }
            }
            else
            {
                using (var db = new SampleEntities())
                {
                    db.OrgChartShapes.Attach(shape);
                    db.ObjectStateManager.ChangeObjectState(shape, EntityState.Modified);
                    db.SaveChanges();
                }
            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the OrgChartShapes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToOrgChartShapes(OrgChartShape orgChartShape)
 {
     base.AddObject("OrgChartShapes", orgChartShape);
 }
 public static void Delete(OrgChartShape shape)
 {
     if (!UpdateDatabase)
     {
         var target = One(p => p.Id == shape.Id);
         if (target != null)
         {
             All().Remove(target);
         }
     }
     else
     {
         using (var db = new SampleEntities())
         {
             db.OrgChartShapes.Attach(shape);
             db.OrgChartShapes.DeleteObject(shape);
             db.SaveChanges();
         }
     }
 }
 /// <summary>
 /// Create a new OrgChartShape object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 public static OrgChartShape CreateOrgChartShape(global::System.Int32 id)
 {
     OrgChartShape orgChartShape = new OrgChartShape();
     orgChartShape.Id = id;
     return orgChartShape;
 }