public ActionResult Input(PurchasedInputViewModel p) { if (ModelState.IsValid) { using (var s = SessionFactoryBuilder.GetSessionFactory().OpenSession()) { s.Merge(p.Purchased); s.Flush(); return(RedirectToAction("Index")); } } else { return(View(p)); } }
public ViewResult InputEdit(int id) { using (var s = SessionFactoryBuilder.GetSessionFactory().OpenSession()) { var l = s.Get <Purchased>(id); var px = new PurchasedInputViewModel { MostSellingProductAdvisory = "Did you know Bumble Bee car is a fast-selling car?", CategoryId = l.Product.Category.CategoryId, Purchased = l }; return(View("Input", px)); } }