public Documentation AddNodeDoc(Documentation nd) { Documentation retval = null; using (SystemMapEntities db = new SystemMapEntities()) { node_docs ndoc = new node_docs { name = nd.name, doctypeid = nd.docTypeId, descr = nd.description, docurl = nd.url, nodeid = nd.componentId }; db.node_docs.Add(ndoc); db.SaveChanges(); retval = new Documentation { documentationId = ndoc.node_docid, name = ndoc.name, description = ndoc.descr, url = ndoc.docurl, docTypeId = ndoc.doctypeid, documentType = new DocType { typeId = ndoc.doctypeid, name = ndoc.doc_type.typename, description = ndoc.doc_type.descr, iconUrl = ndoc.doc_type.iconurl } }; } return(retval); }
public void DeleteNodeDoc(int nodedocid) { using (SystemMapEntities db = new SystemMapEntities()) { node_docs delrec = db.node_docs.Where(d => d.node_docid == nodedocid).SingleOrDefault(); if (delrec != null) { db.node_docs.Remove(delrec); db.SaveChanges(); } } }
public void UpdateNodeDoc(Documentation udata) { using (SystemMapEntities db = new SystemMapEntities()) { node_docs urec = db.node_docs.Where(d => d.node_docid == udata.documentationId).SingleOrDefault(); if (urec != null) { urec.name = udata.name; urec.descr = udata.description; urec.docurl = udata.url; urec.doctypeid = udata.docTypeId; db.SaveChanges(); } } }