public ActionResult Edit(EditModel model) { using (var session = DomainAccess.Instance.CurrentSession.OpenSession()) { using (ITransaction transaction = session.BeginTransaction()) { model.PagetoEdit.LastModifiedDate = DateTime.Now; session.Update(model.PagetoEdit); transaction.Commit(); } } return View(); }
public ActionResult Edit(int id) { Page result; using (var session = DomainAccess.Instance.CurrentSession.OpenSession()) { if (id>0) { result = session.Query<Page>().FirstOrDefault<Page>(x => x.PageID == id); } else { result = new Page(); } } EditModel model = new EditModel(result); return View(model); }