Пример #1
0
 public AniDB_Anime_Category GetByAnimeIDAndCategoryID(int animeid, int catid)
 {
     using (var session = JMMService.SessionFactory.OpenSession())
     {
         AniDB_Anime_Category cr = session
                                   .CreateCriteria(typeof(AniDB_Anime_Category))
                                   .Add(Restrictions.Eq("AnimeID", animeid))
                                   .Add(Restrictions.Eq("CategoryID", catid))
                                   .UniqueResult <AniDB_Anime_Category>();
         return(cr);
     }
 }
Пример #2
0
 public void Save(AniDB_Anime_Category obj)
 {
     using (var session = JMMService.SessionFactory.OpenSession())
     {
         // populate the database
         using (var transaction = session.BeginTransaction())
         {
             session.SaveOrUpdate(obj);
             transaction.Commit();
         }
     }
 }
Пример #3
0
 public void Delete(int id)
 {
     using (var session = JMMService.SessionFactory.OpenSession())
     {
         // populate the database
         using (var transaction = session.BeginTransaction())
         {
             AniDB_Anime_Category cr = GetByID(id);
             if (cr != null)
             {
                 session.Delete(cr);
                 transaction.Commit();
             }
         }
     }
 }