Exemplo n.º 1
0
 public static bool UpdateMindMap(MindMapClass mindmap)
 {
     using (var _context = new DBTopicContext())
     {
         _context.dbMM.AddOrUpdate(mindmap);
         _context.SaveChanges();
         return(true);
     }
 }
Exemplo n.º 2
0
        public static bool AddTopic(TopicClass topic)
        {
            using (var _context = new DBTopicContext())
            {
                _context.dbTopic.Add(topic);
                _context.SaveChanges();

                return(true);
            }
        }
Exemplo n.º 3
0
 public static void RemoveMindMap(int taskID)
 {
     using (var _context = new DBTopicContext())
     {
         var task = (from t in _context.dbMM
                     where t.ID == taskID
                     select t).FirstOrDefault();
         foreach (TopicClass topic in task.listTopics)
         {
             TopicControllers.RemoveTask(topic.ID);
         }
         _context.dbMM.Remove(task);
         _context.SaveChanges();
     }
 }
Exemplo n.º 4
0
 public static bool DeleteTopicConnection(TopicClass first, TopicClass second)
 {
     using (var _context = new DBTopicContext())
     {
         var a = (from u in _context.dbTopic
                  where u.ID == first.ID
                  select u).Single();
         var b = (from u in _context.dbTopic
                  where u.ID == second.ID
                  select u).Single();
         a.listTopics.Remove(b);
         _context.dbTopic.AddOrUpdate(a);
         _context.SaveChanges();
         return(true);
     }
 }
Exemplo n.º 5
0
 public static void RemoveTask(int taskID)
 {
     using (var _context = new DBTopicContext())
     {
         var task = (from t in _context.dbTopic
                     where t.ID == taskID
                     select t).FirstOrDefault();
         foreach (TopicClass topic in task.listTopics)
         {
             topic.listTopics.Remove(task);
         }
         task.listTopics.Clear();
         _context.dbTopic.Remove(task);
         _context.SaveChanges();
     }
 }
Exemplo n.º 6
0
 public static bool  UpdateTopic(TopicClass topic)
 {
     using (var _context = new DBTopicContext())
     {
         var a = (from u in _context.dbTopic.Include("mindMap")
                  where u.ID == topic.ID
                  select u).Single();
         foreach (var t in topic.listTopics)
         {
             var to = (from u in _context.dbTopic.Include("listTopics")
                       where u.ID == t.ID
                       select u).Single();
             if (!to.listTopics.Contains(a))
             {
                 to.listTopics.Add(a);
             }
             else
             {
                 continue;
             }
         }
         a.Text   = topic.Text;
         a.Width  = topic.Width;
         a.Height = topic.Height;
         a.X      = topic.X;
         a.Y      = topic.Y;
         if (a.mindMap == null)
         {
             a.mindMap = (from u in _context.dbMM
                          where u.ID == topic.mindMap.ID
                          select u).Single();
         }
         _context.SaveChanges();
         return(true);
     }
 }