public async Task <Unit> Handle(TarefaUpdateCommand request, CancellationToken cancellationToken)
        {
            var tarefaEntity = mapper.Map <TarefaEntity>(request);

            //atualizando no dominio (sqlserver)
            tarefaDomainService.Update(tarefaEntity);

            //atualizando no mongodb
            await mediator.Publish(new TarefaNotification
            {
                Tarefa = tarefaEntity,
                Action = ActionNotification.Update
            });

            return(Unit.Value);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Put(TarefaUpdateCommand command)
        {
            try
            {
                await tarefaApplicationService.Update(command);

                return(StatusCode(200, new
                {
                    message = "Tarefa atualizada com sucesso."
                }));
            }
            catch (Exception e)
            {
                return(StatusCode(500, new
                {
                    e.Message
                }));
            }
        }
 public async Task Update(TarefaUpdateCommand command)
 {
     await mediator.Send(command);
 }