public void Setup()
        {
            _employeeRepo = new Mock <IEmployeeRepository>();
            _employeeRepo.Setup(x => x.GetEmployees()).Returns(new List <Employee>());

            _query = new GetEmployeeListQuery(_employeeRepo.Object);
        }
Пример #2
0
            protected override async Task <IEnumerable <UserDto> > Handle(RequestContext context, GetEmployeeListQuery request, CancellationToken cancellationToken)
            {
                var result = (await userManager.GetEmployeeList(context.CurrentUser.UserId, true, cancellationToken)).ToList();

                return(result.Select(r => mapper.Map <UserDto>(r)));
            }
        public async Task <List <EmployeeListVm> > Handle(GetEmployeeListQuery request, CancellationToken cancellationToken)
        {
            var list = await employeeService.GetAllEmployeesAsync();

            return(mapper.Map <List <EmployeeListVm> >(list));
        }
Пример #4
0
 public async Task <IActionResult> GetEmployeeList([FromQuery] GetEmployeeListQuery query) => Ok(await Mediator.Send(query));