using MALDFGASSURANCE.Models; using System.Data.Entity; using System.Linq; using System.Net; using System.Web.Mvc; namespace MALDFGASSURANCE.Areas.COMPTABILITE.Controllers { public class EXERCICECOMPTABLEsController : Controller { private MALDFGEntities db = new MALDFGEntities(); // GET: COMPTABILITE/EXERCICECOMPTABLEs public ActionResult Index() { return View(db.EXERCICECOMPTABLE.ToList()); } // GET: COMPTABILITE/EXERCICECOMPTABLEs/Details/5 public ActionResult Details(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } EXERCICECOMPTABLE eXERCICECOMPTABLE = db.EXERCICECOMPTABLE.Find(id); if (eXERCICECOMPTABLE == null) { return HttpNotFound(); } return View(eXERCICECOMPTABLE); } // GET: COMPTABILITE/EXERCICECOMPTABLEs/Create public ActionResult Create() { return View(); } // POST: COMPTABILITE/EXERCICECOMPTABLEs/Create // Afin de déjouer les attaques par survalidation, activez les propriétés spécifiques auxquelles vous voulez établir une liaison. Pour // plus de détails, consultez https://go.microsoft.com/fwlink/?LinkId=317598. [HttpPost] [ValidateAntiForgeryToken] public ActionResult Create([Bind(Include = "idExercice,libelleExercice,dateDebut,dateFin,etat")] EXERCICECOMPTABLE eXERCICECOMPTABLE) { if (ModelState.IsValid) { db.EXERCICECOMPTABLE.Add(eXERCICECOMPTABLE); db.SaveChanges(); return RedirectToAction("Index"); } return View(eXERCICECOMPTABLE); } // GET: COMPTABILITE/EXERCICECOMPTABLEs/Edit/5 public ActionResult Edit(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } EXERCICECOMPTABLE eXERCICECOMPTABLE = db.EXERCICECOMPTABLE.Find(id); if (eXERCICECOMPTABLE == null) { return HttpNotFound(); } return View(eXERCICECOMPTABLE); } // POST: COMPTABILITE/EXERCICECOMPTABLEs/Edit/5 // Afin de déjouer les attaques par survalidation, activez les propriétés spécifiques auxquelles vous voulez établir une liaison. Pour // plus de détails, consultez https://go.microsoft.com/fwlink/?LinkId=317598. [HttpPost] [ValidateAntiForgeryToken] public ActionResult Edit([Bind(Include = "idExercice,libelleExercice,dateDebut,dateFin,etat")] EXERCICECOMPTABLE eXERCICECOMPTABLE) { if (ModelState.IsValid) { db.Entry(eXERCICECOMPTABLE).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(eXERCICECOMPTABLE); } // GET: COMPTABILITE/EXERCICECOMPTABLEs/Delete/5 public ActionResult Delete(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } EXERCICECOMPTABLE eXERCICECOMPTABLE = db.EXERCICECOMPTABLE.Find(id); if (eXERCICECOMPTABLE == null) { return HttpNotFound(); } return View(eXERCICECOMPTABLE); } // POST: COMPTABILITE/EXERCICECOMPTABLEs/Delete/5 [HttpPost, ActionName("Delete")] [ValidateAntiForgeryToken] public ActionResult DeleteConfirmed(int id) { EXERCICECOMPTABLE eXERCICECOMPTABLE = db.EXERCICECOMPTABLE.Find(id); db.EXERCICECOMPTABLE.Remove(eXERCICECOMPTABLE); db.SaveChanges(); return RedirectToAction("Index"); } protected override void Dispose(bool disposing) { if (disposing) { db.Dispose(); } base.Dispose(disposing); } } }