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); }
public async Task <IActionResult> Index() { var cmd = new GetClientsQuery(); var result = await _mediator.Send(cmd); return(View(result)); }
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)); }
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)); }
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); }
protected override IEnumerable <ClientForCreationDto> Handle(GetClientsQuery request) { return(Mapper.Map <IEnumerable <ClientForCreationDto> >(_dbContext.Clients)); }
public async Task <ActionResult <List <ClientDto> > > GetClients([FromQuery] GetClientsQuery query) { query ??= new GetClientsQuery(); return(await Mediator.Send(query)); }