Exemplo n.º 1
0
 private Task CreateTask(XElement element, int parentId)
 {
     var task = new Task { Id = int.Parse(element.Element("id").Value),
                             Name = element.Element("name").Value,
                             ParentId = parentId,
                             SortOrder = int.Parse(element.Element("sort-order").Value),
                             StudentId = studentId};
     var children = element.Elements("children");
     var hasChildren = (children != null && children.Count() > 0);
     if (hasChildren)
     {
         var taskId = int.Parse(element.Element("id").Value);
         task.Children = LoadTasksForItem(children, taskId);
     }
     return task;
 }
Exemplo n.º 2
0
 private void SaveTask(Task task)
 {
     db.Insert(task);
     if (task.Children != null && task.Children.Count() > 0)
     {
         foreach (var childTask in task.Children)
         {
             SaveTask(childTask);
         }
     }
 }
Exemplo n.º 3
0
 public void SetUpData()
 {
     var task = new Task();
     task.Name = "name";
     db.Insert(task);
 }