public static void AddType(Band SelectedBand,ObservableCollection<Genre> Huidigegenres) { try { int aantal = CountBands(); DbParameter paramName = Database.AddParameter("@Name", SelectedBand.Name); DbParameter paramDesc = Database.AddParameter("@Description", SelectedBand.Description); DbParameter paramFB = Database.AddParameter("@FB", SelectedBand.Facebook); DbParameter paramTwit = Database.AddParameter("@Twitter", SelectedBand.Twitter); DbParameter paramPic = Database.AddParameter("@pic", SelectedBand.Picture); // DbParameter parambandid = Database.AddParameter("@bandid", Database.ModifyData("INSERT INTO Bands (Name,Picture,Description,Twitter,Facebook) values (@Name,@pic,@Description,@FB,@Twitter)", paramName, paramDesc, paramFB, paramTwit, paramPic); foreach (Genre item in Huidigegenres) { DbParameter paramBandid = Database.AddParameter("@BandID", aantal); DbParameter paramGenreID = Database.AddParameter("@genreID", item.ID); Database.ModifyData("INSERT INTO Bands_Genre (BandID,GenreID) values (@BandID,@genreid)", paramBandid, paramGenreID); } } catch (Exception e) { Console.WriteLine(e.Message); } }
private static Band VerwerkRij(IDataRecord rij) { Band type = new Band(); type.ID = Convert.ToInt32(rij["ID"].ToString()); type.Name = rij["Name"].ToString(); // type.Picture =Convert.ToByte( rij["Picture"].ToString()); type.Facebook = rij["Facebook"].ToString(); type.Twitter = rij["Twitter"].ToString(); type.Description = rij["Description"].ToString(); return type; }
public static void DeleteType(Band SelectedBand) { throw new NotImplementedException(); }