Пример #1
0
        private async void LoadNovosti(NovostiSearchRequest search = null)
        {
            var lista = await _novosti.Get <List <Model.Novosti> >(search);



            dgvNovosti.DataSource = lista;
        }
Пример #2
0
        private void txtNaslov_TextChanged(object sender, EventArgs e)
        {
            var search = new NovostiSearchRequest()
            {
                Naslov = txtNaslov.Text
            };

            LoadNovosti(search);
        }
Пример #3
0
        private void btnPretrazi_Click(object sender, EventArgs e)
        {
            var search = new NovostiSearchRequest()
            {
                Naslov      = txtNaslov.Text,
                DatumObjave = dtpDatumObjave.Value
            };

            LoadNovosti(search);
        }
Пример #4
0
        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;
        }
Пример #6
0
        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;
        }
Пример #7
0
        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;
        }
Пример #8
0
        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;
        }
Пример #9
0
        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));
        }
Пример #10
0
 public ActionResult <List <Model.Novosti> > Get([FromQuery] NovostiSearchRequest search)
 {
     return(_service.get(search));
 }