public async Task <IEnumerable <UserResponseModel> > Get()
        {
            var query    = new GetAllUsersQueryRequest();
            var response = await mediator.Send(query);

            return(response);
        }
Esempio n. 2
0
        public async Task <IActionResult> GetAllUsers()
        {
            var request = new GetAllUsersRequest();

            var model = new GetAllUsersQueryRequest
            {
                TransferObject = request
            };
            var result = await Mediator.Send(model);

            return(HandleResponse(result, r => r));
        }
Esempio n. 3
0
        //[Ignore]
        public async Task GetAllUsers()
        {
            var getAllUsers = UserHelper.GetAllUsers();

            var model = new GetAllUsersQueryRequest
            {
                TransferObject = getAllUsers
            };

            var result = await _mediator.Send(model);

            result.Status.ShouldBe(EnumOperationResult.Ok);
        }
Esempio n. 4
0
        public async Task <OperationResult <GetAllUsersQueryResponse> > Handle(GetAllUsersQueryRequest request, CancellationToken cancellationToken)
        {
            var response = new GetAllUsersQueryResponse(request.MessageId);
            OperationResult <GetAllUsersQueryResponse> result;

            response.Result = await(from u in _dbContext.UserAccount
                                    select new UserResponse
            {
                UserAccountId   = u.UserAccountId,
                FirstName       = u.FirstName,
                LastName        = u.LastName,
                Email           = u.Email,
                ContactNumber   = u.ContactNumber,
                SystemProfileId = u.SystemProfileId,
                Username        = u.Username,
                AcceptedTerms   = u.AcceptedTerms,
                KnownAs         = u.KnownAs,
                SystemProfile   = u.SystemProfile.DisplayName
            }).ToListAsync();

            result = new OperationResult <GetAllUsersQueryResponse>(EnumOperationResult.Ok, null, response);

            return(result);
        }
Esempio n. 5
0
        public async Task <IEnumerable <UserResponseModel> > Handle(GetAllUsersQueryRequest request, CancellationToken cancellationToken)
        {
            var response = this.repository.GetAll();

            return(response);
        }