示例#1
0
        public async Task ThreeProjectsExist_Executed_ReturnThreeUserAllViewModels()
        {
            // Arrange
            var users = new List <User>
            {
                new User("Thiago Primo", "*****@*****.**", null, "-dpf!#14", "client"),
                new User("Thiago Primo", "*****@*****.**", null, "-dpf!#14", "client"),
                new User("Thiago Primo", "*****@*****.**", null, "-dpf!#14", "client")
            };

            var userRepositoryMock = new Mock <IUserRepository>();

            userRepositoryMock.Setup(pr => pr.GetAllAsync().Result).Returns(users);

            var getAllUserQuery        = new GetAllUserQuery();
            var getAllUserQueryHandler = new GetAllUserQueryHandler(userRepositoryMock.Object);

            //Act
            var userViewAllModel = await getAllUserQueryHandler.Handle(getAllUserQuery, new CancellationToken());

            //Assert
            Assert.NotNull(userViewAllModel);

            userRepositoryMock.Verify(pr => pr.GetAllAsync().Result, Times.Once);
        }
            public async Task <List <GoodFoodUserDto> > Handle(GetAllUserQuery request,
                                                               CancellationToken cancellationToken)
            {
                var users = await _userAuth.GetAllUser();

                return(users);
            }
        public async Task <IActionResult> GetUsers()
        {
            var query  = new GetAllUserQuery();
            var result = await _mediator.Send(query);

            return(Ok(result));
        }
        public async Task <ActionResult <IEnumerable <UserDTO> > > GetAllUser()
        {
            var query  = new GetAllUserQuery();
            var result = await _mediator.Send(query);

            return(Ok(result));
        }
示例#5
0
        public async Task <List <UserDTO> > Handle(GetAllUserQuery request, CancellationToken cancellationToken)
        {
            var result = await userRepository.GetUsersWithRole();

            var mappedResult = mapper.Map <List <UserDTO> >(result);

            return(mappedResult);
        }
示例#6
0
        public async Task <IActionResult> GetAll()
        {
            //var users = _userService.GetAll();
            var getAllUsersQuery = new GetAllUserQuery();

            var users = await _mediator.Send(getAllUsersQuery);

            return(Ok(users));
        }
示例#7
0
        public IQueryable <User> Handle(GetAllUserQuery message)
        {
            if (!message.IsValid())
            {
                NotifyValidationErrors(message);
                return(null);
            }

            return(userRepository.GetAll());
        }
示例#8
0
        public IEnumerable <User> Handle(GetAllUserQuery message)
        {
            var query = _session.Query <User>();

            if (!message.AllowStaleResults)
            {
                query.Customize(c => c.WaitForNonStaleResultsAsOfNow());
            }

            return(query.ToList());
        }
示例#9
0
        public async Task <IActionResult> GetAllUsers()
        {
            var query  = new GetAllUserQuery();
            var result = await _mediator.Send(query);

            if (result.Count == 0)
            {
                return(Content("No users found"));
            }

            return(Ok(result));
        }
示例#10
0
 public async Task <IList <UserInfo> > Handle(GetAllUserQuery request, CancellationToken cancellationToken)
 {
     try
     {
         var model = _db.Users.ToList();
         return(model.Select(_mapper.Map <User, UserInfo>).ToList());
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#11
0
        public async Task <List <UserViewAllModel> > Handle(GetAllUserQuery request, CancellationToken cancellationToken)
        {
            var users = await _userRepository.GetAllAsync();

            var userViewAllModel = new List <UserViewAllModel>();

            //var userViewAllModel = users
            //    .Select(u => new UserViewAllModel(u.FullName, u.Email, u.BirthDate, u.CreatedAt, u.Active))
            //    .ToList();

            return(userViewAllModel);
        }
        public async Task <List <NewUser> > Handle(GetAllUserQuery request, CancellationToken cancellationToken)
        {
            var            userList = userDBContext.Users;
            List <NewUser> newUsers = new List <NewUser>();

            foreach (var dtl in userList)
            {
                var user = new NewUser {
                    Id        = dtl.Id,
                    FirstName = dtl.FirstName,
                    LastName  = dtl.LastName
                };

                newUsers.Add(user);
            }

            return(newUsers);
        }
        public async Task <IList <UserVM> > Handle(GetAllUserQuery request, CancellationToken cancellationToken)
        {
            var users = await _dbContext.UserRecrds.Include(d => d.UserDetails).Include(d => d.UserRoles).ProjectTo <UserVM>(_mapper.ConfigurationProvider).ToListAsync();

            return(users);
        }
 public async Task <List <AppUser> > Handle(GetAllUserQuery request, CancellationToken cancellationToken)
 {
     return(await _repository.GetAll().ToListAsync());
 }
示例#15
0
        /// Method to handle the request.
        /// </summary>
        /// <param name="request">CreateUserCommand</param>
        /// <param name="cancellationToken">CancellationToken</param>
        /// <returns></returns>
        public async Task <IReadOnlyList <Users> > Handle(GetAllUserQuery request, CancellationToken cancellationToken)
        {
            var data = await Task.Run(() => this.unitOfWork.Users.GetAll());

            return((IReadOnlyList <Users>)data);
        }
示例#16
0
        public async Task <ApiResult <IEnumerable <UserResponseQueryModel> > > GetAllUserForFranchisee(GetAllUserQuery filter)
        {
            var result = await _unit.GetRepository <Tbluser>().GetSelectedDataAsync(p => p.Status == 1 && p.UserTypeId == 3 && p.InsertedBy == filter.CurrentUserId && p.ClientId == filter.CurrentCientId, t => new UserResponseQueryModel
            {
                Id            = t.Id,
                FullName      = string.Format("{0} {1} {2}", t.FirstName, t.MiddleName, t.LastName),
                EmailId       = t.Email,
                PhoneNo       = t.PhoneNumber,
                IsApproved    = Convert.ToBoolean(t.IsApproved),
                ApproveStatus = t.IsApproved == 1 ? "Approve" : "Disapprove"
            });

            if (result.HasSuccess)
            {
                return(new ApiResult <IEnumerable <UserResponseQueryModel> >(new ApiResultCode(ApiResultType.Success), result.UserObject));
            }

            return(new ApiResult <IEnumerable <UserResponseQueryModel> >(new ApiResultCode(ApiResultType.Error, messageText: "Data not found")));
        }
示例#17
0
        public async Task <IEnumerable <UserDto> > Handle(GetAllUserQuery request, CancellationToken cancellationToken)
        {
            var users = await _userRepository.GetAllAsync();

            return(_mapper.Map <IEnumerable <User>, IEnumerable <UserDto> >(users));
        }
        public async Task <IEnumerable <GetAllUserQueryResponse> > Handle(GetAllUserQuery request, CancellationToken cancellationToken)
        {
            var response = await _userRepository.GetAsync();

            return(_mapper.Map <IEnumerable <GetAllUserQueryResponse> >(response));
        }
 public Task <List <User> > Handle(GetAllUserQuery request, CancellationToken cancellationToken)
 {
     return(Task.Run(() => {
         return userRepository.GetAllUsers();
     }));
 }
        public async Task <List <UserDto> > Handle(GetAllUserQuery request, CancellationToken cancellationToken)
        {
            var userList = await _context.User.Where(u => u.IsActive == true).ToListAsync();

            return(_mapper.Map <List <UserDto> >(userList));
        }
示例#21
0
        public async Task <IEnumerable <UserRespond> > Handle(GetAllUserQuery request, CancellationToken cancellationToken)
        {
            var items = await _userService.GetAllAsyncWithNoTracking();

            return(_mapper.Map <List <UserRespond> >(items));
        }
示例#22
0
        public async Task <IActionResult> GetAllAsync()
        {
            var query = new GetAllUserQuery();

            return(Ok(await Mediator.Send(query)));
        }