Beispiel #1
0
        public async Task <bool> PatchCompleted(long id, [FromQuery] bool completed)
        {
            PatchCompletedTaskRequest patchCompletedTaskRequest = new PatchCompletedTaskRequest()
            {
                Id = id, Completed = completed
            };
            bool success = await _mediator.Send(patchCompletedTaskRequest);

            return(success);
        }
        public async Task <bool> Handle(PatchCompletedTaskRequest request, CancellationToken cancellationToken)
        {
            TaskDomain task = await _taskRepository.GetAsync(request.Id);

            if (task != null)
            {
                task.Completed = request.Completed;
                await _taskRepository.UpdateAsync(request.Id, task);

                return(true);
            }
            return(false);
        }