/// <summary> /// Adds a new series to the database. The strings and ints store the added data /// </summary> public void AddSeries(string strPublisher, string strUniverse, string strSeries, int intCollIss, int intYear, string strComments, byte[] bytImage) { var newSeries = new Series(); //Sets the added values newSeries.strPublisher = strPublisher; newSeries.strUniverse = strUniverse; newSeries.strSeries = strSeries; newSeries.intCollIss = intCollIss; newSeries.intYear = intYear; newSeries.strComments = strComments; newSeries.bytImage = bytImage; //Adds the entry and saves CTX.Entry(newSeries).State = EntityState.Added; CTX.SaveChanges(); }
/// <summary> /// Edits a series in the database. The strings and ints store the edited data. LVIin stores the tag of the edited series /// </summary> public void EditSeries(string strPublisher, string strUniverse, string strSeries, int intCollIss, int intYear, string strComments, byte[] bytImage, object LVI) { this.LVI = LVI; ClassComics CC = LVI as ClassComics; //Sets the new values CC.SeriesData.strPublisher = strPublisher; CC.SeriesData.strUniverse = strUniverse; CC.SeriesData.strSeries = strSeries; CC.SeriesData.intCollIss = intCollIss; CC.SeriesData.intYear = intYear; CC.SeriesData.strComments = strComments; CC.SeriesData.bytImage = bytImage; //Sets the state of the entry to modified and saves changes CTX.Entry(CC.SeriesData).State = EntityState.Modified; CTX.SaveChanges(); }
/// <summary> /// Deletes the selected series /// </summary> public void DeleteSeries() { CTX.Series.Attach(SeriesData); CTX.Series.Remove(SeriesData); CTX.SaveChanges(); }