| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Data.Entity;
- using System.Linq;
- using System.Net;
- using System.Web;
- using System.Web.Mvc;
- using CD67.ModeleMVC.Entity;
- namespace CD67.ModeleMVC.MVC.Controllers
- {
- public class PARAMsController : Controller
- {
- private Entities db = new Entities();
- // GET: PARAMs
- public ActionResult Index()
- {
- return View(db.PARAM.ToList());
- }
- // GET: PARAMs/Details/5
- public ActionResult Details(string id)
- {
- if (id == null)
- {
- return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
- }
- PARAM pARAM = db.PARAM.Find(id);
- if (pARAM == null)
- {
- return HttpNotFound();
- }
- return View(pARAM);
- }
- // GET: PARAMs/Create
- public ActionResult Create()
- {
- return View();
- }
- // POST: PARAMs/Create
- // Afin de déjouer les attaques par sur-validation, activez les propriétés spécifiques que vous voulez lier. Pour
- // plus de détails, voir http://go.microsoft.com/fwlink/?LinkId=317598.
- [HttpPost]
- [ValidateAntiForgeryToken]
- public ActionResult Create([Bind(Include = "PRM_CLE,PRM_LIB1,PRM_LIB2")] PARAM pARAM)
- {
- if (ModelState.IsValid)
- {
- db.PARAM.Add(pARAM);
- db.SaveChanges();
- return RedirectToAction("Index");
- }
- return View(pARAM);
- }
- // GET: PARAMs/Edit/5
- public ActionResult Edit(string id)
- {
- if (id == null)
- {
- return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
- }
- PARAM pARAM = db.PARAM.Find(id);
- if (pARAM == null)
- {
- return HttpNotFound();
- }
- return View(pARAM);
- }
- // POST: PARAMs/Edit/5
- // Afin de déjouer les attaques par sur-validation, activez les propriétés spécifiques que vous voulez lier. Pour
- // plus de détails, voir http://go.microsoft.com/fwlink/?LinkId=317598.
- [HttpPost]
- [ValidateAntiForgeryToken]
- public ActionResult Edit([Bind(Include = "PRM_CLE,PRM_LIB1,PRM_LIB2")] PARAM pARAM)
- {
- if (ModelState.IsValid)
- {
- db.Entry(pARAM).State = EntityState.Modified;
- db.SaveChanges();
- return RedirectToAction("Index");
- }
- return View(pARAM);
- }
- // GET: PARAMs/Delete/5
- public ActionResult Delete(string id)
- {
- if (id == null)
- {
- return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
- }
- PARAM pARAM = db.PARAM.Find(id);
- if (pARAM == null)
- {
- return HttpNotFound();
- }
- return View(pARAM);
- }
- // POST: PARAMs/Delete/5
- [HttpPost, ActionName("Delete")]
- [ValidateAntiForgeryToken]
- public ActionResult DeleteConfirmed(string id)
- {
- PARAM pARAM = db.PARAM.Find(id);
- db.PARAM.Remove(pARAM);
- db.SaveChanges();
- return RedirectToAction("Index");
- }
- protected override void Dispose(bool disposing)
- {
- if (disposing)
- {
- db.Dispose();
- }
- base.Dispose(disposing);
- }
- }
- }
|