Пример #1
0
        public ActionResult Add(Car car)
        {
            if (ModelState.IsValid)
            {
                o.Add(car);
                return RedirectToAction("Added");
            }

            else
                return View("addpage", car);
        }
Пример #2
0
        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);
            }
        }
Пример #3
0
 public ActionResult Edit(Car car)
 {
     o.Edit(car);
     ViewData["id"] = car.ID;
     return View("editedpage");
 }
Пример #4
0
 public void Add(Car car)
 {
     ISession s = NHibernateUtils.CurrentSession;
     s.Save(car);
 }
Пример #5
0
 public void Edit(Car car)
 {
     ISession s = NHibernateUtils.CurrentSession;
     s.Update(car);
 }