예제 #1
0
		public void Save(IgnoreAnime obj)
		{
			using (var session = JMMService.SessionFactory.OpenSession())
			{
				// populate the database
				using (var transaction = session.BeginTransaction())
				{
					session.SaveOrUpdate(obj);
					transaction.Commit();
				}
			}
		}
예제 #2
0
        public void IgnoreAnime(int animeID, int ignoreType, int userID)
        {
            try
            {
                AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
                AniDB_Anime anime = repAnime.GetByAnimeID(animeID);
                if (anime == null) return;

                JMMUserRepository repUser = new JMMUserRepository();
                JMMUser user = repUser.GetByID(userID);
                if (user == null) return;

                IgnoreAnimeRepository repIgnore = new IgnoreAnimeRepository();
                IgnoreAnime ignore = repIgnore.GetByAnimeUserType(animeID, userID, ignoreType);
                if (ignore != null) return;// record already exists

                ignore = new IgnoreAnime();
                ignore.AnimeID = animeID;
                ignore.IgnoreType = ignoreType;
                ignore.JMMUserID = userID;

                repIgnore.Save(ignore);

            }
            catch (Exception ex)
            {
                logger.ErrorException(ex.ToString(), ex);
            }
        }
        public void IgnoreAnime(int animeID, int ignoreType, int userID)
        {
            try
            {
                AniDB_Anime anime = RepoFactory.AniDB_Anime.GetByAnimeID(animeID);
                if (anime == null) return;

                JMMUser user = RepoFactory.JMMUser.GetByID(userID);
                if (user == null) return;

                IgnoreAnime ignore = RepoFactory.IgnoreAnime.GetByAnimeUserType(animeID, userID, ignoreType);
                if (ignore != null) return; // record already exists

                ignore = new IgnoreAnime();
                ignore.AnimeID = animeID;
                ignore.IgnoreType = ignoreType;
                ignore.JMMUserID = userID;

                RepoFactory.IgnoreAnime.Save(ignore);
            }
            catch (Exception ex)
            {
                logger.Error( ex,ex.ToString());
            }
        }