public void FantomChild() { var parent = new TodoData() { Id = "1", Parent = null, Attributes = new Dictionary <string, string>(), EstimateTime = TimeSpan.FromSeconds(1), Name = "TestTodo", TimeRecords = new[] { new TimeRecordData { Start = new DateTime(2014, 02, 03, 11, 22, 33), End = new DateTime(2014, 02, 03, 11, 22, 34) } }, Completed = true }; var manager = new TodoManager(); manager.UpsertTodo(parent); var pt = manager.GetTodo(parent.Id); pt.AddChild(); manager.UpsertTodoRange(TodoConvert.Convert(pt)); Assert.Single(pt.Children); }
public void Start() { var data = new TodoData() { Id = "1", Parent = null, Attributes = new Dictionary <string, string>(), EstimateTime = TimeSpan.FromSeconds(1), Name = "TestTodo", TimeRecords = new[] { new TimeRecordData { Start = new DateTime(2014, 02, 03, 11, 22, 33), End = new DateTime(2014, 02, 03, 11, 22, 34) } }, Completed = true }; var manager = new TodoManager(); var changes = manager.UpsertTodo(data); var m2 = new TodoManager(); m2.ApplyChange(changes); var todo = m2.GetTodo(data.Id); todo.Start(); var change = manager.UpsertTodo(TodoConvert.ConvertSingle(todo)); var result = manager.TopTodo.First(); Assert.Equal(new[] { "1" }, change.Upsert.Select(t => t.Id).OrderBy(id => id)); Assert.Equal("1", result.Id); Assert.Equal(2, result.TimeRecords.Count()); }
public void DeleteSingleAndNoParent() { var data = new TodoData() { Id = "1", Parent = null, Attributes = new Dictionary <string, string>(), EstimateTime = TimeSpan.FromSeconds(1), Name = "TestTodo", TimeRecords = new[] { new TimeRecordData { Start = new DateTime(2014, 02, 03, 11, 22, 33), End = new DateTime(2014, 02, 03, 11, 22, 34) } }, Completed = true }; var manager = new TodoManager(); manager.UpsertTodo(data); var change = manager.DeleteTodo(data.Id); Assert.Equal(new[] { "1" }, change.Delete.Select(t => t.Id).OrderBy(id => id)); Assert.Empty(manager.TopTodo); }
private void OnEnable() { LoadSettings(); if (EditorApplication.isPlayingOrWillChangePlaymode) { return; } RefreshFiles(); _data = ScriptableObjectUtils.LoadOrCreateAsset <TodoData>(_dataPath); RefreshEntriesToShow(); if (!_autoScan) { return; } _watcher = new FileSystemWatcher(Application.dataPath, "*.cs"); _watcher.Changed += OnChanged; _watcher.Deleted += OnDeleted; _watcher.Renamed += OnRenamed; _watcher.Created += OnCreated; _watcher.EnableRaisingEvents = true; _watcher.IncludeSubdirectories = true; }
public ActionResult Remove(int[] todosIds) { foreach (int todoId in todosIds) { TodoData.Remove(todoId); } return(Redirect("/")); }
private void GetTodoData() { data = AssetDatabaseUtil.GetAllAssetsOfType <TodoData>().FirstOrDefault(); if (data == null) { TodoData temp = ScriptableObject.CreateInstance <TodoData>(); AssetDatabaseUtil.CreateAsset(temp, "Assets/Scripts/Editor/TODO", "TODO Data"); data = AssetDatabaseUtil.GetAllAssetsOfType <TodoData>().FirstOrDefault(); } }
public IActionResult Create([FromBody] TodoData todoData) { //From Body Tells program to get data from body of http reaquest if (todoData == null) { return(BadRequest()); } _context.TodoLists.Add(todoData); _context.SaveChanges(); //Returns 201 return(CreatedAtRoute("GetTodo", new { id = todoData.Id }, todoData)); }
public ActionResult Add(AddTodoViewModel AddTodoViewModel) { ToDo newTodo = new ToDo { Name = AddTodoViewModel.Name, Description = AddTodoViewModel.Description }; TodoData.Add(newTodo); return(Redirect("/ToDo")); }
private void Btn_addtodo_Click(object sender, EventArgs e) { TodoData todo = new TodoData(); todo.id = CLB_TODO.Items.Count; todo.name = TB_addtodo.Text; TB_addtodo.Text = String.Empty; todo.date = DateTime.Now; todo.is_done = false; todolist.Add(todo); flushTODOList(); }
public void ChildAndParent() { var child = new TodoData() { Id = "2", Parent = "1", Attributes = new Dictionary <string, string>(), EstimateTime = TimeSpan.FromSeconds(1), Name = "TestTodo", TimeRecords = new[] { new TimeRecordData { Start = new DateTime(2014, 02, 03, 11, 22, 33), End = new DateTime(2014, 02, 03, 11, 22, 34) } }, Completed = true }; var parent = new TodoData() { Id = "1", Parent = null, Attributes = new Dictionary <string, string>(), EstimateTime = TimeSpan.FromSeconds(1), Name = "TestTodo", TimeRecords = new[] { new TimeRecordData { Start = new DateTime(2014, 02, 03, 11, 22, 33), End = new DateTime(2014, 02, 03, 11, 22, 34) } }, Completed = true }; var manager = new TodoManager(); var change1 = manager.UpsertTodo(child); var change2 = manager.UpsertTodo(parent); var result = manager.TopTodo.First(); Assert.Equal(new[] { "1", "2" }, change1.Upsert.Select(t => t.Id).OrderBy(id => id)); Assert.Equal(new[] { "1" }, change2.Upsert.Select(t => t.Id).OrderBy(id => id)); Assert.Equal("1", result.Id); Assert.True(result.HasChildren); Assert.Equal("2", result.Children.First().Id); }
public void Test() { var man1 = new TodoManager(); var man2 = new TodoManager(); var parent = new TodoData() { Id = "1", Parent = null, Attributes = new Dictionary <string, string>(), EstimateTime = TimeSpan.FromSeconds(1), Name = "TestTodo", TimeRecords = new[] { new TimeRecordData { Start = new DateTime(2014, 02, 03, 11, 22, 33), End = new DateTime(2014, 02, 03, 11, 22, 34) } }, Completed = true }; var c = man1.UpsertTodo(parent); man2.ApplyChange(c); var t = man1.TopTodo.First(); t.AddChild(); c = man2.UpsertTodoRange(TodoConvert.Convert(t)); man1.ApplyChange(c); var tc = t.Children.First(); tc.AddChild(); c = man2.UpsertTodoRange(TodoConvert.Convert(tc)); man1.ApplyChange(c); var tgc = tc.Children.First(); tgc.Name = "Name2"; c = man2.UpsertTodoRange(TodoConvert.Convert(tc)); man1.ApplyChange(c); Assert.Equal("Name2", man1.TopTodo.First().Children.First().Children.First().Name); Assert.Equal(t, t.Children.First().Parent); }
private void OnEnable() { if (EditorApplication.isPlayingOrWillChangePlaymode) return; RefreshFiles(); _data = ScriptableObjectUtils.LoadOrCreateAsset<TodoData>(_dataPath); RefreshEntriesToShow(); _watcher = new FileSystemWatcher(Application.dataPath, "*.cs"); _watcher.Changed += OnChanged; _watcher.Deleted += OnDeleted; _watcher.Renamed += OnRenamed; _watcher.Created += OnCreated; _watcher.EnableRaisingEvents = true; _watcher.IncludeSubdirectories = true; }
public IActionResult Update(int id, [FromBody] TodoData todoData) { //Sends the entire data not just changed if (todoData == null || todoData.Id != id) { return(BadRequest()); } var item = _context.TodoLists.FirstOrDefault(t => t.Id == id); if (item == null) { return(NotFound()); } item.Item = todoData.Item; item.Done = todoData.Done; _context.TodoLists.Update(item); _context.SaveChanges(); return(new NoContentResult()); }
public ActionResult Remove() { ViewBag.title = "Remove Todos"; ViewBag.todos = TodoData.GetAll(); return(View()); }
// GET: ToDo public ActionResult index() { List <ToDo> todos = TodoData.GetAll(); return(View(todos)); }
public TodoListPageViewModelTodo(TodoData source) : this(source.Id, source.Title, source.Deadline, source.IsCompleted) { }
public void UpdateParent() { var parent1 = new TodoData() { Id = "1", Parent = null, Attributes = new Dictionary <string, string>(), EstimateTime = TimeSpan.FromSeconds(1), Name = "TestTodo", TimeRecords = new[] { new TimeRecordData { Start = new DateTime(2014, 02, 03, 11, 22, 33), End = new DateTime(2014, 02, 03, 11, 22, 34) } }, Completed = true }; var parent2 = new TodoData() { Id = "2", Parent = null, Attributes = new Dictionary <string, string>(), EstimateTime = TimeSpan.FromSeconds(1), Name = "TestTodo", TimeRecords = new[] { new TimeRecordData { Start = new DateTime(2014, 02, 03, 11, 22, 33), End = new DateTime(2014, 02, 03, 11, 22, 34) } }, Completed = true }; var children = new TodoData() { Id = "3", Parent = "1", Attributes = new Dictionary <string, string>(), EstimateTime = TimeSpan.FromSeconds(1), Name = "Children", TimeRecords = new[] { new TimeRecordData { Start = new DateTime(2014, 02, 03, 11, 22, 33), End = new DateTime(2014, 02, 03, 11, 22, 34) } }, Completed = true }; var manager = new TodoManager(); manager.UpsertTodo(parent1); manager.UpsertTodo(parent2); manager.UpsertTodo(children); children.Parent = "2"; var change = manager.UpsertTodo(children); var result = manager.TopTodo.Single(t => t.Id == "2").Children.First(); Assert.Equal(new[] { "1", "2", "3" }, change.Upsert.Select(t => t.Id).OrderBy(id => id)); Assert.Equal("3", result.Id); }
public void AddGrandChild() { var grandchild = new TodoData() { Id = "3", Parent = "2", Attributes = new Dictionary <string, string>(), EstimateTime = TimeSpan.FromSeconds(1), Name = "TestTodo", TimeRecords = new[] { new TimeRecordData { Start = new DateTime(2014, 02, 03, 11, 22, 33), End = new DateTime(2014, 02, 03, 11, 22, 34) } }, Completed = true }; var child = new TodoData() { Id = "2", Parent = "1", Attributes = new Dictionary <string, string>(), EstimateTime = TimeSpan.FromSeconds(1), Name = "TestTodo", TimeRecords = new[] { new TimeRecordData { Start = new DateTime(2014, 02, 03, 11, 22, 33), End = new DateTime(2014, 02, 03, 11, 22, 34) } }, Completed = true }; var parent = new TodoData() { Id = "1", Parent = null, Attributes = new Dictionary <string, string>(), EstimateTime = TimeSpan.FromSeconds(1), Name = "TestTodo", TimeRecords = new[] { new TimeRecordData { Start = new DateTime(2014, 02, 03, 11, 22, 33), End = new DateTime(2014, 02, 03, 11, 22, 34) } }, Completed = true }; var manager = new TodoManager(); manager.UpsertTodo(grandchild); manager.UpsertTodo(child); manager.UpsertTodo(parent); Assert.Single(manager.TopTodo); }