public async Task <IActionResult> Add( AddTodoTaskViewModel viewModel) { var todoTask = viewModel.ToModel(); todoTask.OwnerId = _currentUserId.Value; await _repository.AddAsync(todoTask); return(CreatedAtAction( nameof(Get), new { id = todoTask.Id }, TodoTaskViewModel.FromModel(todoTask))); }
public async Task <TodoTask> Handle(CreateTodoTaskCommand request, CancellationToken cancellationToken) { return(await _todoTaskRepository.AddAsync(request.Task)); }