コード例 #1
0
        public async Task <IActionResult> SumAccounts()
        {
            var request = new SumAccounts();

            var result = await _mediator.Send(request);

            return(StatusCodeResult(result));
        }
コード例 #2
0
        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));
            }
        }