コード例 #1
0
 //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()));
     }
 }
コード例 #2
0
 //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()));
     }
 }
コード例 #3
0
 //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));
     }
 }
コード例 #4
0
 //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));
     }
 }
コード例 #5
0
 //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()));
     }
 }
コード例 #6
0
 //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()));
     }
 }