コード例 #1
0
        public async Task <IActionResult> SumGateAdminAccesses()
        {
            var email   = HttpContext.User.Identity.Name;
            var request = new SumGateAdminAccesses {
                RequestedEmail = email
            };

            var result = await _mediator.Send(request);

            return(StatusCodeResult(result));
        }
コード例 #2
0
        public async Task <Result <int> > Handle(SumGateAdminAccesses request, CancellationToken cancellationToken)
        {
            try
            {
                var user = await _userRepository.GetUserByEmail(request.RequestedEmail);

                var result = await _gateRepository.GetSumOfAdminAccesses(user.Id);

                return(Result <int> .Ok(result));
            }
            catch (Exception e)
            {
                return(Result <int> .Failure(e.Message));
            }
        }