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}"); }
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); } }