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); } }
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(); } } }
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(); } } } }