public ActionResult AjouterBieres() { BieresRecord biere = new BieresRecord(); TypesTable types = new TypesTable(Session["Database"]); types.SelectAll(); biere.ListeTypes = types.ToList(); return View(biere); }
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 AjouterTypes(TypesRecord type) { if (ModelState.IsValid) { TypesTable table = new TypesTable(Session["Database"]); table.type = type; table.Insert(); return RedirectToAction("Index", "Bieres"); } return View(type); }
public ActionResult EditerTypes(String Id) { TypesTable types = new TypesTable(Session["Database"]); if (types.SelectByID(Id)) return View(types.type); else return RedirectToAction("ListerTypes", "Bieres"); }
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"); }
//////////////////////////////////////////////////////////// // TYPES //////////////////////////////////////////////////////////// public ActionResult ListerTypes() { TypesTable table = new TypesTable(Session["Database"]); String orderBy = ""; if (Session["SortBy_Type"] != null) orderBy = (String)Session["SortBy_Type"] + " " + (String)Session["SortOrder"]; table.SelectAll(orderBy); return View(table.ToList()); }
public ActionResult EditerTypes(TypesRecord record) { TypesTable table = new TypesTable(Session["Database"]); if (ModelState.IsValid) { if (table.SelectByID(record.Id)) { table.type = record; table.Update(); return RedirectToAction("ListerTypes", "Bieres"); } } return View(record); }