Exemple #1
0
        public override async Task <Empty> PutToDo(ToDoStructure request, ServerCallContext context)
        {
            var response = new Empty();

            _dataContext.ToDoDb.Update(request);
            await _dataContext.SaveChangesAsync();

            return(await Task.FromResult(response));
        }
        // 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());
        }
Exemple #4
0
        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));
        }
        public async Task AddToDo(KeyboardEventArgs e)
        {
            if (e.Key == "Enter" && !string.IsNullOrWhiteSpace(Description) ||
                e.Key == "NumpadEnter" && !string.IsNullOrWhiteSpace(Description))
            {
                var request = new ToDoStructure()
                {
                    Id          = ServerToDoResponse.Count,
                    Description = this.Description,
                    IsCompleted = false
                };
                Description = null;

                await UserClient.AddToDoAsync(request);
                await GetToDoList();
            }
            else
            {
            }
        }
        public async Task PutToDoIsCompleted(int id, string description, bool isCompleted, MouseEventArgs e)
        {
            if (isCompleted == false && e.Button == 0)
            {
                isCompleted = true;
            }
            else if (isCompleted == true && e.Button == 0)
            {
                isCompleted = false;
            }

            var request = new ToDoStructure()
            {
                Id          = id,
                Description = description,
                IsCompleted = isCompleted
            };

            await UserClient.PutToDoAsync(request);

            await GetToDoList();
        }
        public async Task PutToDoDescription(int id, string htmlId, string oldDescription, string newDescription, bool isCompleted)
        {
            var request = new ToDoStructure()
            {
                Id          = id,
                Description = newDescription,
                IsCompleted = isCompleted
            };

            int grpcIndex = ServerToDoResponse.IndexOf(new ToDoStructure()
            {
                Id          = id,
                Description = oldDescription,
                IsCompleted = isCompleted
            });

            await JSRuntime.InvokeVoidAsync("theRealAutoResize", htmlId);

            await JSRuntime.InvokeVoidAsync("initialMode", "edit-icon", "todo-description", "edit-todo", grpcIndex);

            await UserClient.PutToDoAsync(request);

            await GetToDoList();
        }