public static List <Casopis> DohvatiSve() { List <Casopis> listaCasopisa = new List <Casopis>(); BP.otvoriKonekciju(); SqliteCommand command = BP.komanda(); command.CommandText = "Select * from casopis, sadrzaj where casopis.id_sadrzaj = sadrzaj.id"; SqliteDataReader reader = command.ExecuteReader(); while (reader.Read()) { Casopis k = new Casopis(); k.Id = (int)(Int64)reader["id"]; k.Naziv = (string)reader["naziv"]; k.Tagovi = (string)reader["tagovi"]; listaCasopisa.Add(k); } reader.Dispose(); command.Dispose(); return(listaCasopisa); }
public static List<Knjiga> DohvatiSve() { List<Film> listaFilmova = new List<Knjiga>(); BP.otvoriKonekciju(); SqliteCommand command = BP.komanda(); command.CommandText = "Select * from film, sadrzaj where film.id_sadrzaj = sadrzaj.id"; SqliteDataReader reader = command.ExecuteReader(); while (reader.Read()) { Film k = new Film(); k.Id = (int)(Int64)reader["id"]; k.Naziv = (string)reader["naziv"]; k.Tagovi = (string)reader["tagovi"]; listaFilmova.Add(k); } reader.Dispose(); command.Dispose(); return listaFilmova; }
public static void Spremi(Casopis k) { BP.otvoriKonekciju(); SqliteCommand command = BP.komanda(); command.CommandText = @"create table if not exist Casopis ( id integer primary key autoincrement, naziv string, tagovi string)" ; }
public static void Spremi(Film k) { BP.otvoriKonekciju(); SqliteCommand command = BP.komanda(); command.CommandText = @"create table if not exist film ( id integer primary key autoincrement, godina DateTime, naziv string, trajanje integer, cijena double, tagovi string, opis string)"; }