예제 #1
0
        public D_Board_User_Role_Model GetOne(D_Board_Model boardModel, D_User_Model userModel, D_Role_Model roleModel)
        {
            ICriteria ic = NhSession.CreateCriteria(typeof(D_Board_User_Role_Model));

            ic.Add(Restrictions.Eq("BoardGuid", boardModel));
            ic.Add(Restrictions.Eq("UserGuid", userModel));
            ic.Add(Restrictions.Eq("RoleGuid", roleModel));
            return(ic.List <D_Board_User_Role_Model>().SingleOrDefault());
            //IList<D_Board_User_Role_Model> list = ic.List<D_Board_User_Role_Model>();
            //return list.FirstOrDefault<D_Board_User_Role_Model>();
        }
예제 #2
0
 /// <summary>
 /// 保存板块信息
 /// </summary>
 /// <param name="model"></param>
 /// <returns>true or false</returns>
 public bool Save(D_Board_Model model)
 {
     NHibernate.ITransaction tran = NhSession.BeginTransaction();
     try
     {
         NhSession.SaveOrUpdate(model);
         tran.Commit();
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         if (!tran.WasCommitted && !tran.WasRolledBack)
         {
             tran.Rollback();
         }
     }
 }