public ActionResult EditerBar(String id) { BarsTable table = new BarsTable(Session["Database"]); if (table.SelectByID(id)) return View(table.bar); else return RedirectToAction("ListerBars", "Bars"); }
public ActionResult SupprimerBar(String id) { BarsTable barsTable = new BarsTable(Session["Database"]); barsTable.DeleteRecordByID(id); SelectionTable selectionTable = new SelectionTable(Session["Database"]); selectionTable.DeleteAllRecordByFieldName("IdBar", id); return RedirectToAction("ListerBars", "Bars"); }
public ActionResult ListerBars() { BarsTable bars = new BarsTable(Session["Database"]); String orderBy = ""; if (Session["SortBy_Bar"] != null) orderBy = (String)Session["SortBy_Bar"] + " " + (String)Session["SortOrder"]; bars.SelectAll(orderBy); return View(bars.ToList()); }
public ActionResult AjouterBars(BarsRecord bar) { if (ModelState.IsValid) { BarsTable table = new BarsTable(Session["Database"]); table.bar = bar; table.bar.UploadLogo(Request); table.Insert(); return RedirectToAction("ListerBars", "Bars"); } return View(bar); }
public ActionResult AfficherSelections(string Id) { if (!String.IsNullOrEmpty(Id)) { String orderby = ""; if (Session["SortBy_Selection"] != null) orderby = (String)Session["SortBy_Selection"] + " " + (String)Session["SortOrder"]; BieresTable bieres = new BieresTable(Session["Database"]); bieres.SelectFromSelection(Id, orderby); BarsTable bars = new BarsTable(Session["Database"]); bars.SelectByID(Id); Session["Bar"] = bars; SelectionTable selection = new SelectionTable(Session["Database"]); Session["ListePrix"] = selection.ListPrix(Id,orderby); return View(bieres.ToList()); } else return RedirectToAction("ListerBars", "Bars"); }