public async void ChangeStateTodo(Guid id, TodoState state) { var todo = _context.Todo.Where(t => t.Id.Equals(id)).FirstOrDefault(); todo.State = state; await _context.SaveChangesAsync(); }
public static TodoState OnAddTodo(TodoState state, AddTodo action) { var todoList = state.Todos.ToList(); todoList.Add(action.Todo); return(new TodoState(todoList)); }
public static TodoState OnToogleTodo(TodoState state, ToogleTodo action) { var todoList = state.Todos.ToList(); todoList.First(x => x.Id == action.Todo.Id).Done = !action.Todo.Done; return(new TodoState(todoList)); }
public void ObjectCloneTest() { var original = new TodoState(); var cloned = original.Copy(); Assert.AreEqual(UnityEngine.JsonUtility.ToJson(original), UnityEngine.JsonUtility.ToJson(cloned)); Assert.AreNotSame(original, cloned); }
public Todo(int id, string title, string description, DateTime deadline, TodoState state, int priority) { this.Id = id; this.Deadline = deadline; this.Title = title; this.Description = description; this.State = state; this.Priority = priority; }
internal Todo(string name, string desc, DateTime?deadline = null) { this._Name = name; this._Description = desc; this._Deadline = deadline; this._State = TodoState.Todo; this._ID = CurrentID; CurrentID++; }
public void UpdateState(Guid id, TodoState state) { using (var context = new TodoItemContext()) { var item = context.TodoItems.FirstOrDefault(i => i.Id == id); if (item == null) { throw new ArgumentException("Todo Item not found", "id"); } item.LastModificationDate = DateTime.Now; item.State = state; context.SaveChanges(); } }
public static TodoState Execute(TodoState previousState, IAction action) { if (action is ShowCompletedAction) { previousState.ShowCompleted = true; } if (action is ShowPendentAction) { previousState.ShowCompleted = false; } if (action is ToogleCompletedViewAction) { previousState.ShowCompleted = !previousState.ShowCompleted; } if (action is CompleteTodoAction c) { var todo = previousState.Todos.First(t => t.Id == c.Id); todo.Completed = true; } if (action is NewTodoAction newTodo) { var todo = new TodoItem() { Id = previousState.Todos.Max(x => x.Id) + 1, Todo = newTodo.Todo }; previousState.Todos.Add(todo); } return(previousState); }
public static TodoState SetVisibility(TodoState state, VisibilityFilter filter) { state.Filter = filter; state.SetStateChanged(); return(state); }
public static TodoState OnRemoveTodo(TodoState state, RemoveTodo action) => new TodoState(state.Todos.Where(x => x.Id != action.Todo.Id).ToList());
public RegisterNewTodoCommand(string description, TodoState estado, string file) { Description = description; State = estado; File = file; }
public Task() { State = new TodoState(); }
public UpdateTodoCommand(string description, TodoState estado, string file) { Description = description; State = estado; File = file; }
public Todo(string description, TodoState state, string file) { Description = description; State = state; File = file; }