public void DeleteEdgeAttribute(int eattid)
 {
     using (SystemMapEntities db = new SystemMapEntities())
     {
         edge_attributes delrec = db.edge_attributes
                                  .Where(ea => ea.attributeid == eattid)
                                  .SingleOrDefault();
         if (delrec != null)
         {
             db.edge_attributes.Remove(delrec);
             db.SaveChanges();
         }
     }
 }
 public void UpdateNodeAttribute(EdgeAttribute udata)
 {
     using (SystemMapEntities db = new SystemMapEntities())
     {
         edge_attributes urec = db.edge_attributes
                                .Where(ea => ea.attributeid == udata.id)
                                .SingleOrDefault();
         if (urec != null)
         {
             urec.name       = udata.name;
             urec.descr      = udata.description;
             urec.attrtypeid = udata.type.typeId;
             db.SaveChanges();
         }
     }
 }
        public EdgeAttribute AddEdgeAttribute(EdgeAttribute eatt)
        {
            EdgeAttribute retval = null;

            using (SystemMapEntities db = new SystemMapEntities())
            {
                edge_attributes erec = new edge_attributes
                {
                    name       = eatt.name,
                    descr      = eatt.description,
                    attrtypeid = eatt.type.typeId
                };
                db.edge_attributes.Add(erec);
                db.SaveChanges();
                retval = new EdgeAttribute
                {
                    id          = erec.attributeid,
                    name        = erec.name,
                    description = erec.descr
                };
                retval.type = new TypeService().GetAttributeType(erec.attrtypeid);
            }
            return(retval);
        }