Пример #1
0
 //
 // GET: /Story/Create
 public ActionResult Create(int parentId)
 {
     var model = new Story();
     var parent = _storyRepository.GetById(parentId);
     parent.AddChildStory(model);
     return View(model);
 }
Пример #2
0
 public ActionResult Create(Story story)
 {
     try
     {
         _storyRepository.Add(story);
         return View("Details", _storyRepository.GetLeafNodes(story.Parent.Id));
     }
     catch
     {
         return View();
     }
 }
Пример #3
0
 public ActionResult Delete(Story story)
 {
     try
     {
         story = _storyRepository.GetById(story.Id);
         _storyRepository.Delete(story);
         //do we have any leaves left?
         if (_storyRepository.GetLeafNodes(story.Parent.Id).Count <= 0)
         {
             var next = _storyRepository.GetAllAncestorsOfStory(story.Parent.Id).First();
             return View("Details", _storyRepository.GetLeafNodes(next.Id));
         }
         else
         {
             return View("Details", _storyRepository.GetLeafNodes(story.Parent.Id));
         }
     }
     catch
     {
         return View();
     }
 }
Пример #4
0
 public virtual void AddChildStory(Story Story)
 {
     Children.Add(Story);
     Story.Parent = this;
 }