public ActionResult AjouterSelections()
        {
            SelectionsRecord selection = new SelectionsRecord();
            selection.IdBar = ((BarsTable)Session["Bar"]).bar.Id;

            BieresTable bieres = new BieresTable(Session["Database"]);
            bieres.SelectAll("Brasserie, NomBiere");
            selection.ListeBieres = bieres.ToList();

            return View(selection);
        }
        public ActionResult AjouterSelections(SelectionsRecord selection)
        {
            selection.IdBar = ((BarsTable)Session["Bar"]).bar.Id;
            if (ModelState.IsValid)
            {
                SelectionTable table = new SelectionTable(Session["Database"]);
                table.Selection = selection;
                table.Insert();
                return RedirectToAction("AfficherSelections/" + ((BarsTable)Session["Bar"]).bar.Id.ToString());
            }
            else
            {
                BieresTable bieres = new BieresTable(Session["Database"]);
                bieres.SelectAll("Brasserie, NomBiere");
                selection.ListeBieres = bieres.ToList();

                return View(selection);
            }
        }
        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");
        }
예제 #4
0
        ////////////////////////////////////////////////////////////
        // BIÈRES
        ////////////////////////////////////////////////////////////
        public ActionResult ListerBieres()
        {
            BieresTable table = new BieresTable(Session["Database"]);
            String orderBy = "";

            if (Session["SortBy_Bieres"] != null)
                orderBy = (String)Session["SortBy_Bieres"] + " " + (String)Session["SortOrder"];

            table.SelectAll(orderBy);

            return View(table.ToList());
        }