Exemple #1
0
        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)));
        }
Exemple #2
0
 public async Task <TodoTask> Handle(CreateTodoTaskCommand request, CancellationToken cancellationToken)
 {
     return(await _todoTaskRepository.AddAsync(request.Task));
 }