Esempio n. 1
0
        public void RemoveChildren()
        {
            DebatePlatformContext db = new DebatePlatformContext();

            RemoveChildrenRecursive(db);
            db.SaveChanges();
        }
Esempio n. 2
0
        public Argument AddParent()
        {
            DebatePlatformContext db = new DebatePlatformContext();

            Parent = db.Arguments.FirstOrDefault(a => a.ArgumentId == ParentId);
            return(Parent);
        }
Esempio n. 3
0
 public void RemoveChildrenRecursive(DebatePlatformContext db)
 {
     AddChildren();
     foreach (Argument child in Children)
     {
         child.RemoveChildrenRecursive(db);
         db.Arguments.Remove(child);
     }
 }
Esempio n. 4
0
        public Argument AddLink()
        {
            DebatePlatformContext db = new DebatePlatformContext();

            Link = db.Arguments.FirstOrDefault(a => a.ArgumentId == LinkId);
            if (Link != null)
            {
                Link.AddChildrenRecursive();
            }
            return(Link);
        }
Esempio n. 5
0
        public List <Argument> AddChildren()
        {
            DebatePlatformContext db = new DebatePlatformContext();

            Children = db.Arguments
                       .Where(a => a.ParentId == ArgumentId)
                       .ToList();
            foreach (Argument child in Children)
            {
                child.AddParent();
                child.AddLink();
            }
            return(Children.ToList());
        }