public ActionResult EditerSelections(String Id)
 {
     SelectionTable table = new SelectionTable(Session["Database"]);
     table.SelectByID(Id);
     BieresTable bieres = new BieresTable(Session["Database"]);
     bieres.SelectByID(table.Selection.IdBiere);
     table.Selection.ListeBieres = new List<BieresRecord>();
     table.Selection.ListeBieres.Add(bieres.biere);
     return View(table.Selection);
 }
 public ActionResult EditerBieres(String Id)
 {
     BieresTable bieres = new BieresTable(Session["Database"]);
     TypesTable types = new TypesTable(Session["Database"]);
     types.SelectAll();
     bieres.biere.ListeTypes = types.ToList();
     if (bieres.SelectByID(Id))
         return View(bieres.biere);
     else
         return RedirectToAction("ListerBieres", "Bieres");
 }
        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 AjouterBieres(BieresRecord biere)
        {
            if (ModelState.IsValid)
            {
                BieresTable table = new BieresTable(Session["Database"]);
                table.biere = biere;
                table.biere.UploadEtiquette(Request);
                table.Insert();
                return RedirectToAction("Index", "Bieres");
            }

            return View(biere);
        }
 public ActionResult EditerBieres(BieresRecord record)
 {
     BieresTable table = new BieresTable(Session["Database"]);
     if (ModelState.IsValid)
     {
         if (table.SelectByID(record.Id.ToString()))
         {
             record.Etiquette = table.biere.Etiquette;
             table.biere = record;
             table.biere.UploadEtiquette(Request);
             table.Update();
             return RedirectToAction("ListerBieres", "Bieres");
         }
     }
     return View(record);
 }
        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");
        }
 public ActionResult EditerSelections(SelectionsRecord selection)
 {
     if (ModelState.IsValid)
     {
         SelectionTable table = new SelectionTable(Session["Database"]);
         table.Selection = selection;
         table.Update();
         return RedirectToAction("AfficherSelections", "Selections", new { Id = ((BarsTable)Session["Bar"]).bar.Id });
     }
     else
     {
         BieresTable bieres = new BieresTable(Session["Database"]);
         bieres.SelectByID(selection.IdBiere);
         selection.ListeBieres = new List<BieresRecord>();
         selection.ListeBieres.Add(bieres.biere);
         return View(selection);
     }
 }
 public ActionResult SupprimerTypes(String Id)
 {
     TypesTable table = new TypesTable(Session["Database"]);
     BieresTable biere = new BieresTable(Session["Database"]);
     biere.DeleteAllByType(Id);
     table.DeleteRecordByID(Id);
     return RedirectToAction("ListerTypes", "Bieres");
 }
        ////////////////////////////////////////////////////////////
        // 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());
        }