public async Task Bind() { ClanarineSearchRequest request = new ClanarineSearchRequest() { ClanId = Global.PrijavljeniKorisnik.KorisnikId, Godina = DateTime.Now}; var lista = await _clanarineService.Get<List<Biblioteka_Model.Clanarine>>(request); foreach (var item in lista) { clanarineList.Add(item); } }
public List <Biblioteka_Model.Clanarine> Get(ClanarineSearchRequest request) { var query = _context.Clanarine.AsQueryable(); query = query.Where(x => x.KorisnikId == request.ClanId && x.DatumUplate.Year == request.Godina.Year); var list = query.ToList(); foreach (var item in list) { item.Korisnik = _context.Korisnici.Where(x => x.KorisnikId == item.KorisnikId).First(); } return(_mapper.Map <List <Biblioteka_Model.Clanarine> >(list)); }
private async void BtnPretraga_Click(object sender, EventArgs e) { if (ValidateChildren()) { ClanarineSearchRequest request = new ClanarineSearchRequest() { ClanId = Convert.ToInt32(cmbClanovi.SelectedValue), Godina = dtpGodina.Value }; var source = await _clanarineService.Get <List <Biblioteka_Model.Clanarine> >(request); dgvClanarine.AutoGenerateColumns = false; dgvClanarine.Columns[2].DefaultCellStyle.Format = "dd/MM/yyyy"; dgvClanarine.Columns[3].DefaultCellStyle.Format = "dd/MM/yyyy"; dgvClanarine.DataSource = source; lista = new List <Biblioteka_Model.Clanarine>(); lista = source; } }
public List <Biblioteka_Model.Clanarine> Get([FromQuery] ClanarineSearchRequest request) { return(_service.Get(request)); }