Example #1
0
		public static void LinkAniDBTvDBEpisode(int aniDBID, int tvDBID, int animeID)
		{
			CrossRef_AniDB_TvDB_EpisodeRepository repCrossRef = new CrossRef_AniDB_TvDB_EpisodeRepository();
			CrossRef_AniDB_TvDB_Episode xref = repCrossRef.GetByAniDBEpisodeID(aniDBID);
			if (xref == null)
				xref = new CrossRef_AniDB_TvDB_Episode();

			xref.AnimeID = animeID;
			xref.AniDBEpisodeID = aniDBID;
			xref.TvDBEpisodeID = tvDBID;
			repCrossRef.Save(xref);

			StatsCache.Instance.UpdateUsingAnime(animeID);

			logger.Trace("Changed tvdb episode association: {0}", aniDBID);
		}
Example #2
0
        public string RemoveLinkAniDBTvDBEpisode(int aniDBEpisodeID)
        {
            try
            {
                CrossRef_AniDB_TvDB_EpisodeRepository repXrefs = new CrossRef_AniDB_TvDB_EpisodeRepository();
                AniDB_EpisodeRepository repEps = new AniDB_EpisodeRepository();
                AniDB_Episode ep = repEps.GetByEpisodeID(aniDBEpisodeID);

                if (ep == null) return "Could not find Episode";

                CrossRef_AniDB_TvDB_Episode xref = repXrefs.GetByAniDBEpisodeID(aniDBEpisodeID);
                if (xref == null) return "Could not find Link!";

                repXrefs.Delete(xref.CrossRef_AniDB_TvDB_EpisodeID);

                return "";
            }
            catch (Exception ex)
            {
                logger.ErrorException(ex.ToString(), ex);
                return ex.Message;
            }
        }