コード例 #1
0
 // For Delete ACR Document Relation
 public static bool DeleteACRDocumentRelation(int RelId)
 {
     using (EditorsEntities entity = new EditorsEntities())
     {
         doc_in_subtopic docRelation = entity.doc_in_subtopic.Find(RelId);
         if (docRelation != null)
         {
             entity.doc_in_subtopic.Remove(docRelation);
             entity.SaveChanges();
         }
         return(true);
     }
 }
コード例 #2
0
        // To add ACRDocument Relation

        public static bool AddACRDocumentRelation(ACRDocumentRelationshipModel NewRelation, string subtopicId)
        {
            using (EditorsEntities entity = new EditorsEntities())
            {
                doc ACRDocument = entity.docs.Find(NewRelation.DocId);
                if (ACRDocument != null)
                {
                    doc_in_subtopic newRelationDB = new doc_in_subtopic();
                    newRelationDB.doc_id      = NewRelation.DocId;
                    newRelationDB.subtopic_id = Convert.ToInt32(subtopicId);
                    entity.doc_in_subtopic.Add(newRelationDB);
                    entity.SaveChanges();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }