public int AddPost(Post post) { using (var tran = _session.BeginTransaction()) { _session.Save(post); tran.Commit(); return post.Id; } }
public void EditPost(Post post) { using (var tran = _session.BeginTransaction()) { _session.SaveOrUpdate(post); tran.Commit(); } }