public ActionResult CreateBranch(EmployeeBranch emp) { using (ISession session = NHibernateSession.OpenSession()) { using (ITransaction sessionTransact = session.BeginTransaction()) { sessionTransact.Begin(); session.Save(emp); sessionTransact.Commit(); } } return RedirectToAction("Branch"); }
public ActionResult EditBranch(int id, EmployeeBranch empBranch) { using (ISession session = NHibernateSession.OpenSession()) { var employeeBranchSelected = session.Get<EmployeeBranch>(id); employeeBranchSelected.Branch = empBranch.Branch; using (ITransaction ItransactionSesison = session.BeginTransaction()) { ItransactionSesison.Begin(); session.Save(employeeBranchSelected); ItransactionSesison.Commit(); } } return RedirectToAction("Branch"); }