Пример #1
0
        public Task <bool> Handle(RemoveExpenseCommand command)
        {
            var entity = _expenseRepository.Get(command.Id);

            if (entity == null)
            {
                AddNotification("despesa", "Despesa não localizada");
                return(Task.FromResult(false));
            }

            _expenseRepository.Delete(entity);
            _uow.Commit();

            return(Task.FromResult(true));
        }
        public async Task <IActionResult> Delete([FromQuery] RemoveExpenseCommand command, CancellationToken cancellationToken)
        {
            var result = await _mediator.Send(command, cancellationToken);

            return(Ok(result));
        }