示例#1
0
 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");
 }
示例#2
0
        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");
        }