public ActionResult Delete(Shop shop, int id) { try { ShopService.delete(ShopService.getShopById(id)); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Create(Shop shop) { try { ShopService.save(shop); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Edit(Shop shop, int id) { try { ShopService.update(shop, id); return RedirectToAction("Index"); } catch { return View(); } }
public void update(Shop shop, int id) { SessionFactory.GetCurrentSession().Update(shop); //Muy importante realizar el flush SessionFactory.GetCurrentSession().Flush(); }
public void save(Shop shop) { SessionFactory.GetCurrentSession().Save(shop); }
public void delete(Shop shop) { SessionFactory.GetCurrentSession().Delete(shop); SessionFactory.GetCurrentSession().Flush(); }