public Person GetPersonById(int Id) { Person person = new Person(); using (ISession session = NHibernateHelper.OpenSession()) { person = session.Get<Person>(Id); } return person; }
public void UpdatePerson(Person person) { using (ISession session = NHibernateHelper.OpenSession()) { using (ITransaction tran = session.BeginTransaction()) { session.Update(person); tran.Commit(); } } }
public ActionResult Create(Person person) { try { objDs.CreatePerson(person); return RedirectToAction("Index"); } catch { return View(); } }
public int CreatePerson(Person person) { int PersonId = 0; using (ISession session = NHibernateHelper.OpenSession()) { //Perform transaction using (ITransaction tran = session.BeginTransaction()) { session.Save(person); tran.Commit(); } } return PersonId; }
public ActionResult Edit(int id, Person person) { try { objDs.UpdatePerson(person); return RedirectToAction("Index"); } catch { return View(); } }
// // GET: /Person/Create public ActionResult Create() { var person = new Person(); return View(person); }