예제 #1
0
        public async override Task <List <ClientView> > Execute(GetClientsQuery input, User?user)
        {
            List <Client> clients = await service.GetByUser(user !);

            throw new NotImplementedException();
            // return mapper.Map<List<Client>, List<ClientView>>(clients);
        }
예제 #2
0
        public async Task <IActionResult> Index()
        {
            var cmd    = new GetClientsQuery();
            var result = await _mediator.Send(cmd);

            return(View(result));
        }
예제 #3
0
 public async Task <List <ClientDto> > Handle(GetClientsQuery request, CancellationToken cancellationToken)
 {
     return(await _context.Clients
            .AsNoTracking()
            .ProjectTo <ClientDto>(_mapper.ConfigurationProvider)
            .OrderBy(c => c.Name)
            .ToListAsync(cancellationToken));
 }
예제 #4
0
        public async Task <List <ClientDto> > Handle(GetClientsQuery request, CancellationToken cancellationToken)
        {
            var clients = await _context.Clients
                          .Include(x => x.IdResponsable)
                          // .Where(x => x.IdResponsable == _currentUser.IdentityId)
                          .ToListAsync(cancellationToken);

            return(_mapper.Map <List <ClientDto> >(clients));
        }
예제 #5
0
        public async Task <List <ClientListModel> > Handle(GetClientsQuery request, CancellationToken cancellationToken)
        {
            const string sql = @"select C.Id, C.Name, C.Website, C.Description, Count(V.Id) as OpenVacancies
                                    from Clients as C
                                    left join Vacancies as V on C.Id = V.ClientId
                                    group by C.Id, C.Name, C.Website, C.Description";


            using (SqlConnection connection = new SqlConnection(_connectionString.Value))
            {
                var dbItems = await connection.QueryAsync <ClientListModel>(sql);

                return(dbItems.ToList());
            }
        }
        public async Task <BaseSelectResponse <GetClientsViewModel> > Handle(GetClientsQuery request, CancellationToken cancellationToken)
        {
            var clients = await _configurationRepository
                          .All <Client>().AsNoTracking()
                          .Select(GetClientsViewModel.Projection)
                          .Skip((request.PageNumber - 1) * request.PageSize)
                          .Take(request.PageSize)
                          .ToArrayAsync();

            var clientsCount = await _configurationRepository.All <Client>().CountAsync();

            var response = new BaseSelectResponse <GetClientsViewModel>
            {
                Count  = clientsCount,
                Values = clients
            };

            return(response);
        }
예제 #7
0
 protected override IEnumerable <ClientForCreationDto> Handle(GetClientsQuery request)
 {
     return(Mapper.Map <IEnumerable <ClientForCreationDto> >(_dbContext.Clients));
 }
예제 #8
0
 public async Task <ActionResult <List <ClientDto> > > GetClients([FromQuery] GetClientsQuery query)
 {
     query ??= new GetClientsQuery();
     return(await Mediator.Send(query));
 }