Beispiel #1
0
        public static Genre VerwerkRij(IDataRecord rij)
        {
            Genre type = new Genre();

            type.ID = Convert.ToInt32(rij["ID"].ToString());
            type.Name = rij["Name"].ToString();
     
            return type;

        }
Beispiel #2
0
        public static void AddType(Genre newgenre)
        {
            try
            {

                DbParameter paramName = Database.AddParameter("@Name", newgenre.Name);
                Database.ModifyData("INSERT INTO Genre (Name) values (@Name)", paramName);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Beispiel #3
0
        public static void DeleteType(Genre genre)
        {
            try
            {
                DbParameter paramName = Database.AddParameter("@Name", genre.Name);

                Database.ModifyData("DELETE FROM Genre WHERE Name = @Name", paramName);
            }
            catch (Exception e)
            {

                throw e;
            }
            
        }
Beispiel #4
0
        //Genre methods
        private void AddGenre()
        {
            Genre newGenre = new Genre();
            Genres.Add(newGenre);

            SelectedGenre = newGenre;
        }
Beispiel #5
0
        public static void EditGenre(Genre gen)
        {
            try
            {

                string sql = "UPDATE Genre SET Name=@name WHERE ID=@ID;";

                DbParameter par1 = Database.AddParameter("@name", gen.Name);

                DbParameter parID = Database.AddParameter("@ID", Convert.ToInt32(gen.ID));

                Database.ModifyData(sql, par1, parID);



            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                throw ex;
            }
        }