private async void LoadNovosti(NovostiSearchRequest search = null) { var lista = await _novosti.Get <List <Model.Novosti> >(search); dgvNovosti.DataSource = lista; }
private void txtNaslov_TextChanged(object sender, EventArgs e) { var search = new NovostiSearchRequest() { Naslov = txtNaslov.Text }; LoadNovosti(search); }
private void btnPretrazi_Click(object sender, EventArgs e) { var search = new NovostiSearchRequest() { Naslov = txtNaslov.Text, DatumObjave = dtpDatumObjave.Value }; LoadNovosti(search); }
private async void btnPrikazi_Click(object sender, EventArgs e) { var search = new NovostiSearchRequest { Naslov = txtPretraga.Text, }; var result = await _service.get <List <Model.Novosti> >(search); dgwNovosti.DataSource = result; }
private async void btnPrikazi_Click(object sender, EventArgs e) { var search = new NovostiSearchRequest() { Naziv = txtNaziv.Text }; var result = await _novosti.Get <List <Model.Novosti> >(search); dgvNovosti.AutoGenerateColumns = false; dgvNovosti.DataSource = result; }
private async void btnPrikazi_Click(object sender, EventArgs e) { NovostiSearchRequest request = new NovostiSearchRequest() { DatumObjave = dtpDatumObjave.Value.Date, Default = "Nije" }; var novosti = await _novosti.Get <List <Model.Novosti> >(request); dgvNovosti.DataSource = novosti; }
private async void btnPrikazi_Click(object sender, EventArgs e) { NovostiSearchRequest request = new NovostiSearchRequest() { Naziv = txtNaziv.Text }; var objKorisnici = cmbKorisnici.SelectedValue; request.KorisnikId = int.Parse(objKorisnici?.ToString() ?? "0"); var result = await _novostiService.Get <List <Model.Novosti> >(request); dgvNovosti.AutoGenerateColumns = false; dgvNovosti.DataSource = result; }
private async void btnTrazi_Click(object sender, EventArgs e) { NovostiSearchRequest search = new NovostiSearchRequest(); if ((int)cmbPutovanja.SelectedValue == 0) { search = null; } else { search.PutovanjeId = (int?)cmbPutovanja.SelectedValue; } var result = await _novosti.Get <List <Model.Novosti> >(search); dgvNovosti.AutoGenerateColumns = false; dgvNovosti.DataSource = result; }
public List <Model.Novosti> get(NovostiSearchRequest search) { var query = _context.Novosti.Include(o => o.Osoblje).AsQueryable(); if (search != null) { if (search.OsobljeId.HasValue) { query = query.Where(o => o.OsobljeId == search.OsobljeId); } } if (!string.IsNullOrWhiteSpace(search?.Naslov)) { query = query.Where(n => n.Naslov.StartsWith(search.Naslov)); } if (!string.IsNullOrWhiteSpace(search?.Sadrzaj)) { query = query.Where(s => s.Sadrzaj.StartsWith(search.Sadrzaj)); } var list = query.ToList(); return(_mapper.Map <List <Model.Novosti> >(list)); }
public ActionResult <List <Model.Novosti> > Get([FromQuery] NovostiSearchRequest search) { return(_service.get(search)); }