//Učitavanje vrijednosti za checkbox model vozila
        private async Task LoadModelVozila(int?proizvodjacId)
        {
            ModelAutomobilaSearch request = new ModelAutomobilaSearch();

            if (proizvodjacId != null)
            {
                request.ProizvodjacId = proizvodjacId;
            }

            var result = await _modeliService.Get <List <Model.Models.ModelAutomobila> >(request);

            result.Insert(0, new Model.Models.ModelAutomobila());

            ComboBoxLoad <Model.Models.ModelAutomobila> cmbLoad = new ComboBoxLoad <Model.Models.ModelAutomobila>();

            cmbLoad.Load(cmbSearchModel, result, "Naziv", "ModelId");
        }
Exemple #2
0
        public override List <ModelAutomobila> Get(ModelAutomobilaSearch search)
        {
            var query = _context.Set <Database.Model>().OrderBy(x => x.Naziv).AsQueryable();

            if (search.ModelId > 0)
            {
                query = query.Where(x => x.ModelId == search.ModelId);
            }
            if (search.ProizvodjacId > 0)
            {
                query = query.Where(x => x.ProizvodjacId == search.ProizvodjacId);
            }
            if (search?.Naziv != null)
            {
                query = query.Where(x => x.Naziv == search.Naziv);
            }

            var list = query.ToList();

            return(_mapper.Map <List <Model.Models.ModelAutomobila> >(list));
        }