private async void btnPrikazi_Click(object sender, EventArgs e) { var search = new SkladistaSearchRequest() { Naziv = txtSkladistaPretraga.Text }; var result = await _apiService.Get <List <Model.Skladista> >(search); dgvSkladista.AutoGenerateColumns = false; dgvSkladista.DataSource = result; }
private async void BtnPretraga_Click(object sender, EventArgs e) { var search = new SkladistaSearchRequest() { Naziv = txtPretraga.Text, }; var result = await _service.Get <List <Model.Models.Skladista> >(search); dgvSkladista.DataSource = result; }
public List <Skladista> Get(SkladistaSearchRequest search) { { var query = _context.Skladista.AsQueryable(); if (!string.IsNullOrWhiteSpace(search?.Naziv)) { query = query.Where(x => x.Naziv.StartsWith(search.Naziv)); } if (!string.IsNullOrWhiteSpace(search?.Adresa)) { query = query.Where(x => x.Adresa.StartsWith(search.Adresa)); } var list = query.ToList(); return(_mapper.Map <List <Model.Models.Skladista> >(list)); } }
public List <Skladista> Get([FromQuery] SkladistaSearchRequest request) { var list = _service.Get(request); return(list); }