Example #1
0
        public void DodajRestoran(Restoran r)
        {
            bool postoji = false;
            int  index;

            foreach (Restoran p in ListaRestorani)
            {
                if (p.id_restoran == r.id_restoran)
                {
                    postoji = true;
                }
            }
            if (postoji)
            {
                ListaRestorani[r.id_restoran] = r;
            }
            else
            {
                int noviId = (from rt in ListaRestorani select rt).Max(x => x.id_restoran) + 1;
                r.id_restoran = noviId;
                ListaRestorani.Add(r);
            }
        }
Example #2
0
        public void ObrisiRestoran(Restoran r)
        {
            int indeks = ListaRestorani.FindIndex(x => x.id_restoran == r.id_restoran);

            ListaRestorani.RemoveAt(indeks);
        }