private async void btnTrazi_Click(object sender, EventArgs e) { var search = new PutniciKorisniciSearchRequest() { Ime = txtIme.Text, Prezime = txtPrezime.Text }; var list = await _korisnik.Get <List <Model.PutniciKorisnici> >(search); dgvKorisnici.AutoGenerateColumns = false; dgvKorisnici.DataSource = list; }
public List <TuristickaAgencija.Model.PutniciKorisnici> Get(PutniciKorisniciSearchRequest request) { var query = _db.PutniciKorisnici.AsQueryable(); if (!string.IsNullOrWhiteSpace(request?.Ime)) { query = query.Where(x => x.Ime.ToLower().StartsWith(request.Ime.ToLower())); } if (!string.IsNullOrWhiteSpace(request?.Prezime)) { query = query.Where(x => x.Prezime.ToLower().StartsWith(request.Prezime.ToLower())); } var list = query.ToList(); return(_mapper.Map <List <TuristickaAgencija.Model.PutniciKorisnici> >(list)); }
public List <TuristickaAgencija.Model.PutniciKorisnici> Get([FromQuery] PutniciKorisniciSearchRequest request) { return(_service.Get(request)); }