Exemplo n.º 1
0
        public ActionResult Delete(long id)
        {
            if (id > 0)
            {
                InteractionManager interactionManager = new InteractionManager();
                SubjectManager     subjectManager     = new SubjectManager();
                PredicateManager   predicateManager   = new PredicateManager();

                //get all interaction with this predicate
                var interactions = interactionManager.GetAll().Where(i => i.Predicate.Id.Equals(id));

                // delete the interactions
                foreach (var interaction in interactions)
                {
                    interactionManager.Delete(interaction);
                }

                // delete the predictae

                var predicate = predicateManager.Get(id);
                if (predicate != null)
                {
                    predicateManager.Delete(predicate);
                }
            }

            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        private void testIntractions()
        {
            SubjectManager subjectManager = new SubjectManager();


            Subject subject = new Subject();

            subject.Name        = "ALTER FETTE SCHEIßE 3";
            subject.Description = "ES FUNKT 3";
            subjectManager.Create(subject);

            Subject Object = new Subject();

            Object.Name        = "ALTER FETTE SCHEIßE 3";
            Object.Description = "ES FUNKT 3";
            subjectManager.Create(Object);

            Predicate positive =
                subjectManager.GetAll <Predicate>().Where(p => p.Name.ToLower().Equals("positiv")).FirstOrDefault();

            Predicate predicate = new Predicate();

            predicate.Parent = positive;
            predicate.Name   = "X";

            InteractionManager interactionManager = new InteractionManager();
            Interaction        interaction        = new Interaction();

            interaction.Subject   = subject;
            interaction.Object    = Object;
            interaction.Predicate = predicate;

            interactionManager.Create(interaction);
            interactionManager.Delete(interaction);
        }
Exemplo n.º 3
0
 public ActionResult Delete(long id)
 {
     if (id > 0)
     {
         InteractionManager interactionManager = new InteractionManager();
         Interaction        interaction        = interactionManager.Get(id);
         interactionManager.Delete(interaction);
     }
     return(RedirectToAction("ShowInteractions", "Interaction"));
 }