コード例 #1
0
        public async Task Save()
        {
            var dto = TaskEditViewModel.ConvertToDto(this.TaskForm);

            if (dto.Id == 0)
            {
                dto.Created = DateTimeOffset.UtcNow;
                dto         = await this.todoService.Create(dto);
            }
            else
            {
                dto = await this.todoService.Update(dto);
            }

            this.navigationManager.NavigateTo($"/taskview/{dto.Id}");
        }
コード例 #2
0
        public async Task RetirieveTodoTaskAsync(int id)
        {
            if (id == 0)
            {
                this.TaskForm = new EditForm
                {
                    Finished = false,
                    DueDate  = DateTimeOffset.Now
                };
            }
            else
            {
                var dto = await this.todoService.Get(id);

                this.TaskForm = TaskEditViewModel.ConvertToForm(dto);
            }
        }