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)); }
public async Task <List <UserDTO> > Handle(GetAllUserQuery request, CancellationToken cancellationToken) { var result = await userRepository.GetUsersWithRole(); var mappedResult = mapper.Map <List <UserDTO> >(result); return(mappedResult); }
public async Task <IActionResult> GetAll() { //var users = _userService.GetAll(); var getAllUsersQuery = new GetAllUserQuery(); var users = await _mediator.Send(getAllUsersQuery); return(Ok(users)); }
public IQueryable <User> Handle(GetAllUserQuery message) { if (!message.IsValid()) { NotifyValidationErrors(message); return(null); } return(userRepository.GetAll()); }
public IEnumerable <User> Handle(GetAllUserQuery message) { var query = _session.Query <User>(); if (!message.AllowStaleResults) { query.Customize(c => c.WaitForNonStaleResultsAsOfNow()); } return(query.ToList()); }
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)); }
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; } }
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()); }
/// 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); }
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"))); }
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)); }
public async Task <IEnumerable <UserRespond> > Handle(GetAllUserQuery request, CancellationToken cancellationToken) { var items = await _userService.GetAllAsyncWithNoTracking(); return(_mapper.Map <List <UserRespond> >(items)); }
public async Task <IActionResult> GetAllAsync() { var query = new GetAllUserQuery(); return(Ok(await Mediator.Send(query))); }