Exemplo n.º 1
0
 public EmployeeInfo GetEmployeeById(int Id)
 {
     EmployeeInfo Emp = new EmployeeInfo();
     using (ISession session = OpenSession())
     {
         Emp = session.Get<EmployeeInfo>(Id);
     }
     return Emp;
 }
Exemplo n.º 2
0
 public void DeleteEmployee(EmployeeInfo Emp)
 {
     using (ISession session = OpenSession())
     {
         using (ITransaction tran = session.BeginTransaction())
         {
             session.Delete(Emp);
             tran.Commit();
         }
     }
 }
 public ActionResult Edit(int id, EmployeeInfo Emp)
 {
     try
     {
         objDs.UpdateEmployee(Emp);
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
 public ActionResult Create(EmployeeInfo Emp)
 {
     try
     {
         objDs.CreateEmployee(Emp);
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
Exemplo n.º 5
0
 public int CreateEmployee(EmployeeInfo Emp)
 {
     int EmpNo = 0;
     using (ISession session = OpenSession())
     {
         //Perform transaction 
         using (ITransaction tran = session.BeginTransaction())
         {
             session.Save(Emp);
             tran.Commit();
         }
     }
     return EmpNo;
 }
 // 
 // GET: /EmployeeInfo/Create 
 public ActionResult Create()
 {
     var Emp = new EmployeeInfo();
     return View(Emp);
 }