public TblSubject getSubject(int givenID) { TblSubject tdObj = (TblSubject)NHSession.CreateCriteria(typeof(TblSubject)) .Add(Restrictions.Eq(Constants.allModelProperties.SubjectId, givenID)) .UniqueResult(); return(tdObj); }
public bool deleteSubject(TblSubject s) { bool result = false; using (ITransaction T = NHSession.BeginTransaction()) { try { NHSession.Delete(s); T.Commit(); result = true; } catch (Exception ex) { T.Rollback(); } } return(result); }
public bool AddSubject(TblSubject subject) { bool result = false; using (ITransaction T = NHSession.BeginTransaction()) { try { NHSession.SaveOrUpdate(subject); T.Commit(); result = true; } catch (Exception ex) { T.Rollback(); } } return(result); }