//update public Tuple <string, int> AnimeDatabase_Update_Description(AnimeDatabase_Description updatedDescription) { using (var context = new ADContext()) { context.Entry(updatedDescription).State = EntityState.Modified; return(new Tuple <string, int>(updatedDescription.description, context.SaveChanges())); } }
//update public Tuple <string, int> AnimeDatabase_Update_Anime(AnimeDatabase_Anime newAnime) { using (var context = new ADContext()) { context.Entry(newAnime).State = EntityState.Modified; return(new Tuple <string, int>(newAnime.AnimeName, context.SaveChanges())); } }
//add new public Tuple <string, int> AnimeDatabase_Add_Description(AnimeDatabase_Description newDescription) { using (var context = new ADContext()) { var newID = context.Description.Add(newDescription); context.SaveChanges(); return(new Tuple <string, int>(newDescription.description, newID.DescriptionID)); } }
//add new public Tuple <string, int> AnimeDatabase_Add_Anime(AnimeDatabase_Anime newAnime) { using (var context = new ADContext()) { var newID = context.Anime.Add(newAnime); context.SaveChanges(); return(new Tuple <string, int>(newAnime.AnimeName, newID.AnimeID)); } }
//delete public Tuple <string, int> AnimeDatabase_Delete_Description(int DescriptionID) { using (var context = new ADContext()) { var Description = context.Description.Find(DescriptionID); if (Description == null) { throw new Exception("Description Not Found. Please sselect another Description."); } context.Description.Remove(Description); return(new Tuple <string, int>(Description.description, context.SaveChanges())); } }
//delete public Tuple <string, int> AnimeDatabase_Delete_Anime(int AnimeID) { using (var context = new ADContext()) { var anime = context.Anime.Find(AnimeID); if (anime == null) { throw new Exception("Anime Not Found. Please select another anime."); } context.Anime.Remove(anime); return(new Tuple <string, int>(anime.AnimeName, context.SaveChanges())); } }