示例#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));
 }