public ActionResult Add(Car car) { if (ModelState.IsValid) { o.Add(car); return RedirectToAction("Added"); } else return View("addpage", car); }
public JsonResult Add(Car car) { if (ModelState.IsValid) { o.Add(car); return Json(new Dictionary<string, object> { { "success", 1 } }, JsonRequestBehavior.AllowGet); } else { Dictionary<string, object> dic = Car.GetErrors(ModelState); return Json(dic, JsonRequestBehavior.AllowGet); } }
public ActionResult Edit(Car car) { o.Edit(car); ViewData["id"] = car.ID; return View("editedpage"); }
public void Add(Car car) { ISession s = NHibernateUtils.CurrentSession; s.Save(car); }
public void Edit(Car car) { ISession s = NHibernateUtils.CurrentSession; s.Update(car); }