public async Task <IActionResult> SumAccounts() { var request = new SumAccounts(); var result = await _mediator.Send(request); return(StatusCodeResult(result)); }
public async Task <Result <int> > Handle(SumAccounts request, CancellationToken cancellationToken) { try { var result = await _accountRepository.GetSumOfAccounts(); return(Result <int> .Ok(result)); } catch (Exception e) { return(Result <int> .Failure(e.Message)); } }