public async Task AddToDoItem(ToDoItem todoitem) { IsBusy = true; ToDoItemList.Add(todoitem); //Per simulare lunga operazione di insert await Task.Delay(TimeSpan.FromSeconds(3)); IsBusy = false; }
public async Task <IActionResult> CreateTodoItemList(string listName) { var newTodoItemList = new ToDoItemList { ListName = listName, UserId = (await CurrentUserAsync()).Id }; Uof.ToDoItemLists.Add(newTodoItemList); Uof.Complete(); return(Ok(Mapper.Map <ToDoItemList, ToDoItemListRessource>(newTodoItemList))); }
public override Task <ToDoItemList> GetToDoList(Empty request, ServerCallContext context) { var todoList = new ToDoItemList();; foreach (ToDoStructure todo in _dataContext.ToDoDb) { todoList.ToDoList.Add(todo); } return(Task.FromResult(todoList)); }
// Delete to-do in the list public async Task DeleteToDo(int id) { var toDoList = new ToDoItemList(); var request = new DeleteToDoParameter() { Id = id }; toDoList.ToDoList.RemoveAt(id); await UserClient.DeleteToDoAsync(request); }
// Insert to-do list public async Task PutToDo(int id, string description, bool isCompleted) { var toDoList = new ToDoItemList(); var request = new ToDoStructure() { Id = id, Description = description, IsCompleted = isCompleted }; var response = await UserClient.PutToDoAsync(request); toDoList.ToDoList.Insert(id, request); }
// Add to-do list public Empty AddToDo(string description) { var toDoList = new ToDoItemList(); var request = new ToDoStructure() { Id = toDoList.ToDoList.Count, Description = description, IsCompleted = false }; toDoList.ToDoList.Add(request); UserClient.AddToDoAsync(request); return(new Empty()); }
public override async Task <Empty> AddToDo(ToDoStructure request, ServerCallContext context) { var toDoList = new ToDoItemList(); var response = new Empty(); _dataContext.ToDoDb.Add(new ToDoStructure() { Id = toDoList.ToDoList.Count, Description = request.Description, IsCompleted = false }); await _dataContext.SaveChangesAsync(); return(await Task.FromResult(response)); }
private static void InitToDoItemList() { todoItemList = new ToDoItemList("todoItemList"); }
public void AddToDoItem(ToDoItem todoitem) { ToDoItemList.Add(todoitem); }