Пример #1
0
        private static void BindRelation(IEnumerable <TodoItem> todoItems)
        {
            foreach (var todo in todoItems)
            {
                if (todo.ProjectId != 0)
                {
                    var p = Projects.First(x => x.Id == todo.ProjectId);
                    p.AddItem(todo);
                }
                var cs = Contexts.Where(x => todo.ContextIds.Contains(x.Id));
                foreach (var c in cs)
                {
                    c.AddItem(todo);
                }
            }
            Inbox = new Inbox();
            Inbox.AddRangeItem(todoItems.Where(x => x.ProjectId == 0));

            Dues = CreateDueContainers().ToObservableCollection();
            foreach (var d in Dues)
            {
                d.AddRangeItem(todoItems.Where(x => x.Due.CompareTo(d.StartDate) >= 0 && x.Due.CompareTo(d.EndDate) < 0));
            }
        }