|
|
@@ -1,17 +1,159 @@
|
|
|
-using System;
|
|
|
-using System.Collections.Generic;
|
|
|
-using System.Linq;
|
|
|
-using System.Web;
|
|
|
+using CD67.FicheCollege.Entity;
|
|
|
+using CD67.FicheCollege.Factory;
|
|
|
+using CD67.FicheCollege.MVC.Models;
|
|
|
+using System.Net;
|
|
|
using System.Web.Mvc;
|
|
|
|
|
|
namespace CD67.FicheCollege.MVC.Controllers
|
|
|
{
|
|
|
public class ActionEduThematiquesController : Controller
|
|
|
{
|
|
|
- // GET: ActionThematiques
|
|
|
+ private Entities db = new Entities();
|
|
|
+
|
|
|
+ // GET: ActionAxes
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
- return View();
|
|
|
+ ActionEduThematiqueFactory fact = new ActionEduThematiqueFactory(db);
|
|
|
+ ActionEduThematiqueIndexViewModel model = new ActionEduThematiqueIndexViewModel(fact.getAll());
|
|
|
+ return View(model);
|
|
|
+ }
|
|
|
+
|
|
|
+ // GET: ActionEduThematique/Details/5
|
|
|
+ public ActionResult Details(int? id)
|
|
|
+ {
|
|
|
+ if (id == null)
|
|
|
+ {
|
|
|
+ return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
|
|
+ }
|
|
|
+ ActionEduThematiqueFactory ActionEduThematiqueFactory = new ActionEduThematiqueFactory(db);
|
|
|
+ Entity.ActionEduThematique ActionEduThematique = ActionEduThematiqueFactory.getById(id.Value);
|
|
|
+ if (ActionEduThematique == null)
|
|
|
+ {
|
|
|
+ return HttpNotFound();
|
|
|
+ }
|
|
|
+ ActionEduThematiqueViewModel model = new ActionEduThematiqueViewModel(ActionEduThematique);
|
|
|
+ return View(model);
|
|
|
+ }
|
|
|
+
|
|
|
+ // GET: ActionEduThematique/Create
|
|
|
+ public ActionResult Create()
|
|
|
+ {
|
|
|
+ Entity.ActionEduThematique ActionEduThematique = new Entity.ActionEduThematique();
|
|
|
+ ActionEduThematiqueViewModel model = new ActionEduThematiqueViewModel(ActionEduThematique);
|
|
|
+ return View(model);
|
|
|
+ }
|
|
|
+
|
|
|
+ // POST: ActionEduThematique/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(ActionEduThematique ActionEduThematique)
|
|
|
+ {
|
|
|
+ if (ModelState.IsValid)
|
|
|
+ {
|
|
|
+ ActionEduThematiqueFactory ActionEduThematiqueFactory = new ActionEduThematiqueFactory(db);
|
|
|
+ ActionEduThematiqueFactory.add(ref ActionEduThematique);
|
|
|
+ return RedirectToAction("Index");
|
|
|
+ }
|
|
|
+
|
|
|
+ ActionEduThematiqueViewModel model = new ActionEduThematiqueViewModel(ActionEduThematique);
|
|
|
+ return View(model);
|
|
|
+ }
|
|
|
+
|
|
|
+ // GET: ActionEduThematique/Edit/5
|
|
|
+ public ActionResult Edit(int? id)
|
|
|
+ {
|
|
|
+ if (id == null)
|
|
|
+ {
|
|
|
+ return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
|
|
+ }
|
|
|
+ ActionEduThematiqueFactory ActionEduThematiqueFactory = new ActionEduThematiqueFactory(db);
|
|
|
+ Entity.ActionEduThematique ActionEduThematique = ActionEduThematiqueFactory.getById(id.Value);
|
|
|
+ if (ActionEduThematique == null)
|
|
|
+ {
|
|
|
+ return HttpNotFound();
|
|
|
+ }
|
|
|
+ ActionEduThematiqueViewModel model = new ActionEduThematiqueViewModel(ActionEduThematique);
|
|
|
+ return View(model);
|
|
|
+ }
|
|
|
+
|
|
|
+ // POST: ActionEduThematique/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(ActionEduThematique ActionEduThematique)
|
|
|
+ {
|
|
|
+ if (ModelState.IsValid)
|
|
|
+ {
|
|
|
+ ActionEduThematiqueFactory ActionEduThematiqueFactory = new ActionEduThematiqueFactory(db);
|
|
|
+ ActionEduThematiqueFactory.update(ref ActionEduThematique);
|
|
|
+ return RedirectToAction("Index");
|
|
|
+ }
|
|
|
+ ActionEduThematiqueViewModel model = new ActionEduThematiqueViewModel(ActionEduThematique);
|
|
|
+ return View(model);
|
|
|
+ }
|
|
|
+
|
|
|
+ // GET: ActionEduThematique/Delete/5
|
|
|
+ public ActionResult Delete(int? id)
|
|
|
+ {
|
|
|
+ if (id == null)
|
|
|
+ {
|
|
|
+ return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
|
|
+ }
|
|
|
+ ActionEduThematiqueFactory ActionEduThematiqueFactory = new ActionEduThematiqueFactory(db);
|
|
|
+ Entity.ActionEduThematique ActionEduThematique = ActionEduThematiqueFactory.getById(id.Value);
|
|
|
+ if (ActionEduThematique == null)
|
|
|
+ {
|
|
|
+ return HttpNotFound();
|
|
|
+ }
|
|
|
+ ActionEduThematiqueViewModel model = new ActionEduThematiqueViewModel(ActionEduThematique);
|
|
|
+ return View(model);
|
|
|
+ }
|
|
|
+
|
|
|
+ // POST: ActionEduThematique/Delete/5
|
|
|
+ [HttpPost, ActionName("Delete")]
|
|
|
+ [ValidateAntiForgeryToken]
|
|
|
+ public ActionResult DeleteConfirmed(int id)
|
|
|
+ {
|
|
|
+ ActionEduThematiqueFactory ActionEduThematiqueFactory = new ActionEduThematiqueFactory(db);
|
|
|
+ Entity.ActionEduThematique ActionEduThematique = ActionEduThematiqueFactory.getById(id);
|
|
|
+ ActionEduThematiqueFactory.delete(ref ActionEduThematique);
|
|
|
+ return RedirectToAction("Index");
|
|
|
+ }
|
|
|
+
|
|
|
+ public ActionResult Up(int? id)
|
|
|
+ {
|
|
|
+ if (id == null)
|
|
|
+ {
|
|
|
+ return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
|
|
+ }
|
|
|
+ ActionEduThematiqueFactory ActionEduThematiqueFactory = new ActionEduThematiqueFactory(db);
|
|
|
+ Entity.ActionEduThematique ActionEduThematique = ActionEduThematiqueFactory.getById(id.Value);
|
|
|
+ ActionEduThematiqueFactory.Up(ref ActionEduThematique);
|
|
|
+ return RedirectToAction("Index");
|
|
|
+ }
|
|
|
+
|
|
|
+ public ActionResult Down(int? id)
|
|
|
+ {
|
|
|
+ if (id == null)
|
|
|
+ {
|
|
|
+ return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
|
|
+ }
|
|
|
+ ActionEduThematiqueFactory ActionEduThematiqueFactory = new ActionEduThematiqueFactory(db);
|
|
|
+ Entity.ActionEduThematique ActionEduThematique = ActionEduThematiqueFactory.getById(id.Value);
|
|
|
+ ActionEduThematiqueFactory.Down(ref ActionEduThematique);
|
|
|
+ return RedirectToAction("Index");
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void Dispose(bool disposing)
|
|
|
+ {
|
|
|
+ if (disposing)
|
|
|
+ {
|
|
|
+ db.Dispose();
|
|
|
+ }
|
|
|
+ base.Dispose(disposing);
|
|
|
}
|
|
|
}
|
|
|
}
|