Exemple #1
0
        public async Task <IActionResult> Delete(string id)
        {
            var todoTask = await _repository.GetAsync(id);

            if (todoTask is null)
            {
                return(NotFound());
            }

            if (!todoTask.OwnerId.Equals(_currentUserId.Value))
            {
                return(Forbid());
            }

            await _repository.DeleteAsync(todoTask);

            return(new EmptyResult());
        }
 public async Task DeleteAsync(TodoTask todoTask, CancellationToken token)
 {
     await todoTaskRepository.DeleteAsync(todoTask, token);
 }
Exemple #3
0
        public async Task <Unit> Handle(DeleteTodoTaskCommand request, CancellationToken cancellationToken)
        {
            await _repository.DeleteAsync(request.Task);

            return(Unit.Value);
        }