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 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);
     }
 }
Ejemplo n.º 4
0
 public SelectionTable(object cs)
     : base(cs)
 {
     Selection = new SelectionsRecord();
     SetTableName("Selections");
 }
Ejemplo n.º 5
0
 public SelectionTable()
 {
     Selection = new SelectionsRecord();
     SetTableName("Selections");
 }