コード例 #1
0
        public async Task <IActionResult> GetCarrierUsers(string carrierId)
        {
            try
            {
                if (!_userContext.UserId.HasValue)
                {
                    throw new EmptyUserIdException("UserId is null");
                }

                await _securityService.GuardActionAsync(SecurityActions.Loadshop_Ui_System_Carrier_User_Add_Edit);

                // If the user is not an admin user, then we should exclude admin users from the results
                var excludeAdminUsers = !await _securityService.IsAdminAsync();

                var response = await _userAdminService.GetCarrierUsersAsync(carrierId, excludeAdminUsers);

                return(Success(response));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
コード例 #2
0
            public void NullOrWhitespaceCarrierId_ThrowsException(string carrierId)
            {
                Func <Task> action = () => _svc.GetCarrierUsersAsync(carrierId, false);

                action.Should().Throw <ArgumentNullException>(nameof(carrierId));
            }