예제 #1
0
        public async Task Init()
        {
            if (teretaneList.Count == 0)
            {
                ClanTeretanaSearchRequest request = new ClanTeretanaSearchRequest();
                request.ClanId = Global.LogiraniClanId;
                var teretanelist = await _clanteretana.Get <List <ClanTeretana> >(request);


                ClanTeretana sveTeretane = new ClanTeretana();
                Teretana     sveTer      = new Teretana
                {
                    TeretanaId = 0,
                    Naziv      = "Sve teretane"
                };
                sveTeretane.Teretana       = sveTer;
                sveTeretane.ClanTeretanaId = 0;

                teretaneList.Clear();
                teretaneList.Add(sveTeretane);



                foreach (var teretana in teretanelist)
                {
                    teretaneList.Add(teretana);
                }
            }


            if (SelectedTeretana != null && SelectedTeretana.TeretanaId == 0)
            {
                PlacanjeClanarineSearchRequest search = new PlacanjeClanarineSearchRequest();
                search.ClanId = Global.LogiraniClanId;

                var list = await _placeneClanarine.Get <IEnumerable <PlacanjeClanarine> >(search);

                ClanarineList.Clear();
                foreach (var clanarina in list)
                {
                    ClanarineList.Add(clanarina);
                }
            }



            if (SelectedTeretana != null && SelectedTeretana.TeretanaId != 0)
            {
                PlacanjeClanarineSearchRequest search = new PlacanjeClanarineSearchRequest();
                search.TeretanaId = SelectedTeretana.TeretanaId;
                search.ClanId     = Global.LogiraniClanId;

                var list = await _placeneClanarine.Get <IEnumerable <PlacanjeClanarine> >(search);

                ClanarineList.Clear();
                foreach (var clanarina in list)
                {
                    ClanarineList.Add(clanarina);
                }
            }
        }