Exemplo n.º 1
0
        public void addStudent(string imie, string nazwisko, string indeks)
        {
            DAO_Student    dao   = new DAO_Student();
            List <Student> list  = dao.getStudenci();
            int            index = list.Last().id;
            Student        nstud = new Student(index + 1, imie, nazwisko, indeks);

            list.Add(nstud);
            dao.setStudenci(list);
        }
Exemplo n.º 2
0
 public void editStudent(int index, string imie, string nazwisko, string indeks)
 {
     if (index != 0)
     {
         DAO_Student    dao  = new DAO_Student();
         List <Student> list = dao.getStudenci();
         foreach (var k in list)
         {
             if (k.id == index)
             {
                 k.imie     = imie;
                 k.nazwisko = nazwisko;
                 k.indeks   = indeks;
             }
         }
         dao.setStudenci(list);
     }
 }
Exemplo n.º 3
0
        public void deleteStudent(int index)
        {
            DAO_Student    dao       = new DAO_Student();
            List <Student> list      = dao.getStudenci();
            Student        to_delete = null;

            foreach (var k in list)
            {
                if (k.id == index)
                {
                    to_delete = k;
                }
            }
            if (to_delete != null)
            {
                list.Remove(to_delete);
            }
            dao.setStudenci(list);
        }