コード例 #1
0
        public async Task Init()
        {
            if (VrsteProizvodaList.Count == 0)
            {
                var vrsteProizvodaList = await _vrsteProizvodaService.Get <List <VrsteProizvoda> >(null);

                foreach (var vrsteProizvoda in vrsteProizvodaList)
                {
                    VrsteProizvodaList.Add(vrsteProizvoda);
                }
            }

            if (SelectedVrstaProizvoda != null)
            {
                ProizvodiSearchRequest searchRequest = new ProizvodiSearchRequest();
                searchRequest.VrstaId = SelectedVrstaProizvoda.VrstaId;

                var list = await _proizvodiService.Get <IList <Proizvodi> >(searchRequest);

                ProizvodiList.Clear();
                foreach (var item in list)
                {
                    ProizvodiList.Add(item);
                }
            }
        }
コード例 #2
0
        public async Task Init()
        {
            if (VrsteProizvodaList.Count == 0)
            {
                var VrsteProizvodalist = await _VrsteProizvodaService.Get <List <VrsteProizvoda> >(null);

                foreach (var vrstaProizvoda in VrsteProizvodalist)
                {
                    VrsteProizvodaList.Add(vrstaProizvoda);
                }
            }
            if (SelectedVrstaProizvoda != null)
            {
                ProizvodSearchRequest search = new ProizvodSearchRequest();
                search.VrstaProizvodaId = SelectedVrstaProizvoda.Id;

                var list = await _service.Get <List <Proizvod> >(search);

                ProizvodiList.Clear();
                foreach (var proizvod in list)
                {
                    ProizvodiList.Add(proizvod);
                }
            }
        }
コード例 #3
0
ファイル: ProizvodiViewModel.cs プロジェクト: kgacan/eProdaja
        public async Task Init()
        {
            if (VrsteProizvodaList.Count() == 0)
            {
                var vrsteProizvodaList = await _vrstePorizvodaService.Get <List <VrsteProizvoda> >(null);

                foreach (var vrsteProizvoda in vrsteProizvodaList)
                {
                    VrsteProizvodaList.Add(vrsteProizvoda);
                }
            }

            if (selectedVrsteProizvoda != null)
            {
                ProizvodiSearchRequest search = new ProizvodiSearchRequest();
                search.VrstaId = selectedVrsteProizvoda.VrstaId;


                var list = await _proizvodiService.Get <IEnumerable <Proizvod> >(search);

                ProizvodiList.Clear();
                foreach (var proizvod in list)
                {
                    ProizvodiList.Add(proizvod);
                }
            }
        }
コード例 #4
0
        public async Task Init(string a = "")
        {
            HttpResponseMessage list;

            if (SelectedVP != null)
            {       //SearchProizvodiMobile
                list = proizvodiService.GetResponse2par("SearchProizvodiMobile", _selectedVP.VrstaID, hlppretraga);
                List <Proizvodi>    ProizvodiList1 = list.Content.ReadAsAsync <List <Proizvodi> >().Result;
                HttpResponseMessage ocjeneResponse;
                ProizvodiList.Clear();
                foreach (var item in ProizvodiList1)
                {
                    ocjeneResponse = ocjeneService.GetActionResponseID("GetProsjek", item.ProizvodID);
                    List <Ocjene> ocjene = ocjeneResponse.Content.ReadAsAsync <List <Ocjene> >().Result;
                    item.Prosjecna = IzracunajProsjek(ocjene);
                    item.Prosjecna = Math.Round(item.Prosjecna, 1);
                    ProizvodiList.Add(item);
                }
            }
            else
            {
                list = proizvodiService.GetResponse2par("SearchProizvodiMobile", 0, hlppretraga);

                List <Proizvodi> ProizvodiList2 = list.Content.ReadAsAsync <List <Proizvodi> >().Result;

                ProizvodiList.Clear();
                VrsteProizvodaList.Clear();
                foreach (var item in ProizvodiList2)
                {
                    ProizvodiList.Add(item);
                }
            }
            if (VrsteProizvodaList.Count == 0)
            {
                list = vrsteProizvodaService.GetResponse();
                List <VrsteProizvoda> vplist = list.Content.ReadAsAsync <List <VrsteProizvoda> >().Result;
                VrsteProizvodaList.Add(new VrsteProizvoda {
                    VrstaID = 0, Naziv = "Prikaži sve vrste"
                });
                foreach (var item in vplist)
                {
                    VrsteProizvodaList.Add(item);
                }
            }
        }
コード例 #5
0
        public async Task Init()
        {
            if (VrsteProizvodaList.Count() == 0)
            {
                var listVrsteProizvodi = await _vrsteProizvodaService.Get <List <VrsteProizvoda> >(null);

                foreach (var vrsteProizvoda in listVrsteProizvodi)
                {
                    VrsteProizvodaList.Add(vrsteProizvoda);
                }
            }

            if (SelectedVrstaProizvoda != null)
            {
                ProizvodiSearchRequest request = new ProizvodiSearchRequest
                {
                    VrstaId = SelectedVrstaProizvoda.VrstaId
                };

                var listProizvodi = await _proizvodiService.Get <IEnumerable <Proizvod> >(request);

                ProizvodiList.Clear();
                foreach (var proizvod in listProizvodi)
                {
                    ProizvodiList.Add(proizvod);
                }
                return;
            }

            var listProizvodii = await _proizvodiService.Get <IEnumerable <Proizvod> >(null);

            ProizvodiList.Clear();
            foreach (var proizvod in listProizvodii)
            {
                ProizvodiList.Add(proizvod);
            }
        }