Просмотр исходного кода

NEW Ecran d'admin Type collège et Territoires (sans le contact)

julien.legrand 8 лет назад
Родитель
Сommit
ab6b4e3754

+ 2 - 0
CD67.FicheCollege.Factory/CD67.FicheCollege.Factory.csproj

@@ -67,6 +67,8 @@
       <DependentUpon>GenericFactories.tt</DependentUpon>
     </Compile>
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="TerritoireFactory.cs" />
+    <Compile Include="TypeCollegeFactory.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="App.config">

+ 68 - 0
CD67.FicheCollege.Factory/TerritoireFactory.cs

@@ -0,0 +1,68 @@
+using CD67.FicheCollege.Entity;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Data.Entity;
+
+namespace CD67.FicheCollege.Factory
+{
+    public partial class TerritoireFactory : Internal.BaseFactory<Entity.Territoire>
+    {
+        public override IQueryable<Entity.Territoire> getAll()
+        {
+            return base.getAll("Ordre");
+        }
+
+        public void Up(ref Entity.Territoire item)
+        {
+            int ordre = item.Ordre;
+
+            //Cas de sortie immédiate
+            if (item.Ordre == 1) return;
+
+            Entity.Territoire itemToSubstitute = dbContext.Territoires.Where(i => i.Ordre == ordre - 1).First();
+            itemToSubstitute.Ordre += 1;
+            item.Ordre -= 1;
+            dbContext.SaveChanges();
+        }
+
+        public void Down(ref Entity.Territoire item)
+        {
+            int ordre = item.Ordre;
+
+            //Cas de sortie immédiate
+            if (item.Ordre == dbContext.Territoires.Max(i => i.Ordre)) return;
+
+            Entity.Territoire itemToSubstitute = dbContext.Territoires.Where(i => i.Ordre == ordre + 1).First();
+            itemToSubstitute.Ordre -= 1;
+            item.Ordre += 1;
+            dbContext.SaveChanges();
+        }
+
+        private void Sort()
+        {
+            int ordre = 1;
+            foreach (Entity.Territoire statut in dbContext.Territoires.OrderBy(i => i.Ordre))
+            {
+                statut.Ordre = ordre++;
+            }
+            dbContext.SaveChanges();
+        }
+
+        public override void add(ref Entity.Territoire entity)
+        {
+            //Initialisation de l'ordre
+            if (dbContext.Territoires.Count() == 0) entity.Ordre = 1;
+            else entity.Ordre = dbContext.Territoires.Max(i => i.Ordre) + 1;
+
+            base.add(ref entity);
+        }
+
+        public override void delete(ref Entity.Territoire entity)
+        {
+            base.delete(ref entity);
+            Sort();
+        }
+    }
+}

+ 68 - 0
CD67.FicheCollege.Factory/TypeCollegeFactory.cs

@@ -0,0 +1,68 @@
+using CD67.FicheCollege.Entity;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Data.Entity;
+
+namespace CD67.FicheCollege.Factory
+{
+    public partial class TypeCollegeFactory : Internal.BaseFactory<Entity.TypeCollege>
+    {
+        public override IQueryable<Entity.TypeCollege> getAll()
+        {
+            return base.getAll("Ordre");
+        }
+
+        public void Up(ref Entity.TypeCollege item)
+        {
+            int ordre = item.Ordre;
+
+            //Cas de sortie immédiate
+            if (item.Ordre == 1) return;
+
+            Entity.TypeCollege itemToSubstitute = dbContext.TypesCollege.Where(i => i.Ordre == ordre - 1).First();
+            itemToSubstitute.Ordre += 1;
+            item.Ordre -= 1;
+            dbContext.SaveChanges();
+        }
+
+        public void Down(ref Entity.TypeCollege item)
+        {
+            int ordre = item.Ordre;
+
+            //Cas de sortie immédiate
+            if (item.Ordre == dbContext.TypesCollege.Max(i => i.Ordre)) return;
+
+            Entity.TypeCollege itemToSubstitute = dbContext.TypesCollege.Where(i => i.Ordre == ordre + 1).First();
+            itemToSubstitute.Ordre -= 1;
+            item.Ordre += 1;
+            dbContext.SaveChanges();
+        }
+
+        private void Sort()
+        {
+            int ordre = 1;
+            foreach (Entity.TypeCollege statut in dbContext.TypesCollege.OrderBy(i => i.Ordre))
+            {
+                statut.Ordre = ordre++;
+            }
+            dbContext.SaveChanges();
+        }
+
+        public override void add(ref Entity.TypeCollege entity)
+        {
+            //Initialisation de l'ordre
+            if (dbContext.TypesCollege.Count() == 0) entity.Ordre = 1;
+            else entity.Ordre = dbContext.TypesCollege.Max(i => i.Ordre) + 1;
+
+            base.add(ref entity);
+        }
+
+        public override void delete(ref Entity.TypeCollege entity)
+        {
+            base.delete(ref entity);
+            Sort();
+        }
+    }
+}

+ 13 - 1
CD67.FicheCollege.MVC/CD67.FicheCollege.MVC.csproj

@@ -152,7 +152,10 @@
   </ItemGroup>
   <ItemGroup>
     <Compile Include="App_Start\BundleConfig.cs" />
+    <Compile Include="Controllers\AdminController.cs" />
     <Compile Include="Controllers\HomeController.cs" />
+    <Compile Include="Controllers\TerritoireController.cs" />
+    <Compile Include="Controllers\TypeCollegeController.cs" />
     <Compile Include="Global.asax.cs">
       <DependentUpon>Global.asax</DependentUpon>
     </Compile>
@@ -311,6 +314,15 @@
     <Content Include="Views\Shared\DisplayTemplates\Date.cshtml" />
     <Content Include="Views\Shared\EditorTemplates\Date.cshtml" />
     <Content Include="Views\Shared\_Flash.cshtml" />
+    <Content Include="Views\Admin\Index.cshtml" />
+    <Content Include="Views\TypeCollege\Create.cshtml" />
+    <Content Include="Views\TypeCollege\Delete.cshtml" />
+    <Content Include="Views\TypeCollege\Edit.cshtml" />
+    <Content Include="Views\TypeCollege\Index.cshtml" />
+    <Content Include="Views\Territoire\Create.cshtml" />
+    <Content Include="Views\Territoire\Delete.cshtml" />
+    <Content Include="Views\Territoire\Edit.cshtml" />
+    <Content Include="Views\Territoire\Index.cshtml" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="App_Data\" />
@@ -348,7 +360,7 @@
           <AutoAssignPort>True</AutoAssignPort>
           <DevelopmentServerPort>54846</DevelopmentServerPort>
           <DevelopmentServerVPath>/</DevelopmentServerVPath>
-          <IISUrl>http://localhost:54846/</IISUrl>
+          <IISUrl>http://localhost:54850/</IISUrl>
           <NTLMAuthentication>False</NTLMAuthentication>
           <UseCustomServer>False</UseCustomServer>
           <CustomServerUrl>

+ 1 - 3
CD67.FicheCollege.MVC/Content/cd67-custom.css

@@ -1,14 +1,12 @@
 /* Breadcrumb et mise en avant */
 .color1 {
-    color: white;
+    color: #DA1251;
 }
 
 #breadcrumbs-one a {
     color: black;
 }
 
-
-
 /* Fond de la sidebar */
 .color2 {
     color: #5a5555;

+ 17 - 0
CD67.FicheCollege.MVC/Controllers/AdminController.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+
+namespace CD67.FicheCollege.MVC.Controllers
+{
+    public class AdminController : Controller
+    {
+        // GET: Admin
+        public ActionResult Index()
+        {
+            return View();
+        }
+    }
+}

+ 157 - 0
CD67.FicheCollege.MVC/Controllers/TerritoireController.cs

@@ -0,0 +1,157 @@
+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.FicheCollege.Entity;
+using CD67.FicheCollege.Factory;
+
+namespace CD67.FicheCollege.MVC.Controllers
+{
+    public class TerritoireController : Controller
+    {
+        private Entities db = new Entities();
+
+        // GET: Territoire
+        public ActionResult Index()
+        {
+            TerritoireFactory territoireFactory = new TerritoireFactory(db);
+            return View(territoireFactory.getAll());
+        }
+
+        // GET: Territoire/Details/5
+        public ActionResult Details(int? id)
+        {
+            if (id == null)
+            {
+                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+            }
+            TerritoireFactory territoireFactory = new TerritoireFactory(db);
+            Entity.Territoire territoire = territoireFactory.getById(id.Value);
+            if (territoire == null)
+            {
+                return HttpNotFound();
+            }
+            return View(territoire);
+        }
+
+        // GET: Territoire/Create
+        public ActionResult Create()
+        {
+            Entity.Territoire territoire = new Entity.Territoire();
+            return View(territoire);
+        }
+
+        // POST: Territoire/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(Territoire territoire)
+        {
+            if (ModelState.IsValid)
+            {
+                TerritoireFactory territoireFactory = new TerritoireFactory(db);
+                territoireFactory.add(ref territoire);
+                return RedirectToAction("Index");
+            }
+
+            return View(territoire);
+        }
+
+        // GET: Territoire/Edit/5
+        public ActionResult Edit(int? id)
+        {
+            if (id == null)
+            {
+                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+            }
+            TerritoireFactory territoireFactory = new TerritoireFactory(db);
+            Entity.Territoire territoire = territoireFactory.getById(id.Value);
+            if (territoire == null)
+            {
+                return HttpNotFound();
+            }
+            return View(territoire);
+        }
+
+        // POST: Territoire/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(Territoire territoire)
+        {
+            if (ModelState.IsValid)
+            {
+                TerritoireFactory territoireFactory = new TerritoireFactory(db);
+                territoireFactory.update(ref territoire);
+                return RedirectToAction("Index");
+            }
+            return View(territoire);
+        }
+
+        // GET: Territoire/Delete/5
+        public ActionResult Delete(int? id)
+        {
+            if (id == null)
+            {
+                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+            }
+            TerritoireFactory territoireFactory = new TerritoireFactory(db);
+            Entity.Territoire territoire = territoireFactory.getById(id.Value);
+            if (territoire == null)
+            {
+                return HttpNotFound();
+            }
+            return View(territoire);
+        }
+
+        // POST: Territoire/Delete/5
+        [HttpPost, ActionName("Delete")]
+        [ValidateAntiForgeryToken]
+        public ActionResult DeleteConfirmed(int id)
+        {
+            TerritoireFactory territoireFactory = new TerritoireFactory(db);
+            Entity.Territoire territoire = territoireFactory.getById(id);
+            territoireFactory.delete(ref territoire);
+            return RedirectToAction("Index");
+        }
+
+        public ActionResult Up(int? id)
+        {
+            if (id == null)
+            {
+                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+            }
+            TerritoireFactory territoireFactory = new TerritoireFactory(db);
+            Entity.Territoire territoire = territoireFactory.getById(id.Value);
+            territoireFactory.Up(ref territoire);
+            return RedirectToAction("Index");
+        }
+
+        public ActionResult Down(int? id)
+        {
+            if (id == null)
+            {
+                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+            }
+            TerritoireFactory territoireFactory = new TerritoireFactory(db);
+            Entity.Territoire territoire = territoireFactory.getById(id.Value);
+            territoireFactory.Down(ref territoire);
+            return RedirectToAction("Index");
+        }
+
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                db.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+    }
+}

+ 157 - 0
CD67.FicheCollege.MVC/Controllers/TypeCollegeController.cs

@@ -0,0 +1,157 @@
+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.FicheCollege.Entity;
+using CD67.FicheCollege.Factory;
+
+namespace CD67.FicheCollege.MVC.Controllers
+{
+    public class TypeCollegeController : Controller
+    {
+        private Entities db = new Entities();
+
+        // GET: TypeCollege
+        public ActionResult Index()
+        {
+            TypeCollegeFactory typeCollegeFactory = new TypeCollegeFactory(db);
+            return View(typeCollegeFactory.getAll());
+        }
+
+        // GET: TypeCollege/Details/5
+        public ActionResult Details(int? id)
+        {
+            if (id == null)
+            {
+                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+            }
+            TypeCollegeFactory typeCollegeFactory = new TypeCollegeFactory(db);
+            Entity.TypeCollege typeCollege = typeCollegeFactory.getById(id.Value);
+            if (typeCollege == null)
+            {
+                return HttpNotFound();
+            }
+            return View(typeCollege);
+        }
+
+        // GET: TypeCollege/Create
+        public ActionResult Create()
+        {
+            Entity.TypeCollege typeCollege = new Entity.TypeCollege();
+            return View(typeCollege);
+        }
+
+        // POST: TypeCollege/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(TypeCollege typeCollege)
+        {
+            if (ModelState.IsValid)
+            {
+                TypeCollegeFactory typeCollegeFactory = new TypeCollegeFactory(db);
+                typeCollegeFactory.add(ref typeCollege);
+                return RedirectToAction("Index");
+            }
+
+            return View(typeCollege);
+        }
+
+        // GET: TypeCollege/Edit/5
+        public ActionResult Edit(int? id)
+        {
+            if (id == null)
+            {
+                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+            }
+            TypeCollegeFactory typeCollegeFactory = new TypeCollegeFactory(db);
+            Entity.TypeCollege typeCollege = typeCollegeFactory.getById(id.Value);
+            if (typeCollege == null)
+            {
+                return HttpNotFound();
+            }
+            return View(typeCollege);
+        }
+
+        // POST: TypeCollege/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(TypeCollege typeCollege)
+        {
+            if (ModelState.IsValid)
+            {
+                TypeCollegeFactory typeCollegeFactory = new TypeCollegeFactory(db);
+                typeCollegeFactory.update(ref typeCollege);
+                return RedirectToAction("Index");
+            }
+            return View(typeCollege);
+        }
+
+        // GET: TypeCollege/Delete/5
+        public ActionResult Delete(int? id)
+        {
+            if (id == null)
+            {
+                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+            }
+            TypeCollegeFactory typeCollegeFactory = new TypeCollegeFactory(db);
+            Entity.TypeCollege typeCollege = typeCollegeFactory.getById(id.Value);
+            if (typeCollege == null)
+            {
+                return HttpNotFound();
+            }
+            return View(typeCollege);
+        }
+
+        // POST: TypeCollege/Delete/5
+        [HttpPost, ActionName("Delete")]
+        [ValidateAntiForgeryToken]
+        public ActionResult DeleteConfirmed(int id)
+        {
+            TypeCollegeFactory typeCollegeFactory = new TypeCollegeFactory(db);
+            Entity.TypeCollege typeCollege = typeCollegeFactory.getById(id);
+            typeCollegeFactory.delete(ref typeCollege);
+            return RedirectToAction("Index");
+        }
+
+        public ActionResult Up(int? id)
+        {
+            if (id == null)
+            {
+                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+            }
+            TypeCollegeFactory typeCollegeFactory = new TypeCollegeFactory(db);
+            Entity.TypeCollege typeCollege = typeCollegeFactory.getById(id.Value);
+            typeCollegeFactory.Up(ref typeCollege);
+            return RedirectToAction("Index");
+        }
+
+        public ActionResult Down(int? id)
+        {
+            if (id == null)
+            {
+                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
+            }
+            TypeCollegeFactory typeCollegeFactory = new TypeCollegeFactory(db);
+            Entity.TypeCollege typeCollege = typeCollegeFactory.getById(id.Value);
+            typeCollegeFactory.Down(ref typeCollege);
+            return RedirectToAction("Index");
+        }
+
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                db.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+    }
+}

+ 13 - 1
CD67.FicheCollege.MVC/Mvc.sitemap

@@ -5,7 +5,19 @@
             enableLocalization="true">
 
   <mvcSiteMapNode title="Accueil" controller="Home" action="Index">
-    
+    <mvcSiteMapNode title="Administration" controller="Admin" action="Index">
+      <mvcSiteMapNode title="Types de collège" controller="TypeCollege" action="Index">
+        <mvcSiteMapNode title="Création d'un type de collège" controller="TypeCollege" action="Create" />
+        <mvcSiteMapNode title="Edition d'un type de collège" controller="TypeCollege" action="Edit" preservedRouteParameters="id" />
+        <mvcSiteMapNode title="Suppression d'un type de collège" controller="TypeCollege" action="Delete" preservedRouteParameters="id" />
+      </mvcSiteMapNode>
+
+      <mvcSiteMapNode title="Territoires" controller="Territoire" action="Index">
+        <mvcSiteMapNode title="Création d'un territoire" controller="Territoire" action="Create" />
+        <mvcSiteMapNode title="Edition d'un territoire" controller="Territoire" action="Edit" preservedRouteParameters="id" />
+        <mvcSiteMapNode title="Suppression d'un territoire" controller="Territoire" action="Delete" preservedRouteParameters="id" />
+      </mvcSiteMapNode>
+    </mvcSiteMapNode>
   </mvcSiteMapNode>
 
 </mvcSiteMap>

+ 12 - 0
CD67.FicheCollege.MVC/Views/Admin/Index.cshtml

@@ -0,0 +1,12 @@
+
+@{
+    ViewBag.Title = "Administration";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+<h2>Listes de choix</h2>
+
+<h4>Chapitre 1</h4>
+<hr />
+@Html.ActionLink("Administration des types de collège", "Index", "TypeCollege")<br />
+@Html.ActionLink("Administration des territoires", "Index", "Territoire")<br />

+ 2 - 1
CD67.FicheCollege.MVC/Views/Shared/_Layout.cshtml

@@ -88,7 +88,7 @@
                         <span class="fa fa-headphones title">Accueil</span>
                     </div>
                     <ul class="submenu hidden">
-                        <li><a href="@Url.Action("Index", "Home", new { })"><span>Accueil</span></a></li>
+                        <li><a href="@Url.Action("Index", "Admin", new { })"><span>Administration</span></a></li>
                     </ul>
                 </li>
             </ul>
@@ -127,5 +127,6 @@
             </div>
         </div>
     </footer>
+    @RenderSection("Scripts", false)
 </body>
 </html>

+ 44 - 0
CD67.FicheCollege.MVC/Views/Territoire/Create.cshtml

@@ -0,0 +1,44 @@
+@model CD67.FicheCollege.Entity.Territoire
+
+@{
+    ViewBag.Title = "Création";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+<h2>Création</h2>
+
+
+@using (Html.BeginForm()) 
+{
+    @Html.AntiForgeryToken()
+    
+    <div class="form-horizontal">
+        <h4>Territoire</h4>
+        <hr />
+        @Html.ValidationSummary(true, "", new { @class = "text-danger" })
+        @Html.HiddenFor(model => model.Id)
+        @Html.HiddenFor(model => model.Ordre)
+
+        <div class="form-group">
+            @Html.LabelFor(model => model.Libelle, htmlAttributes: new { @class = "control-label col-md-2" })
+            <div class="col-md-10">
+                @Html.EditorFor(model => model.Libelle, new { htmlAttributes = new { @class = "form-control" } })
+                @Html.ValidationMessageFor(model => model.Libelle, "", new { @class = "text-danger" })
+            </div>
+        </div>
+
+        <div class="form-group">
+            <div class="col-md-offset-2 col-md-10">
+                <input type="submit" value="Créer" class="btn btn-default" />
+            </div>
+        </div>
+    </div>
+}
+
+<div>
+    @Html.ActionLink("Retour à la liste", "Index")
+</div>
+
+@section Scripts {
+    @Scripts.Render("~/bundles/jqueryval")
+}

+ 33 - 0
CD67.FicheCollege.MVC/Views/Territoire/Delete.cshtml

@@ -0,0 +1,33 @@
+@model CD67.FicheCollege.Entity.Territoire
+
+@{
+    ViewBag.Title = "Suppression";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+<h2>Suppression</h2>
+
+<h3>Voulez-vous vraiment supprimer cet élément?</h3>
+<div>
+    <h4>Territoire</h4>
+    <hr />
+    <dl class="dl-horizontal">
+        <dt>
+            @Html.DisplayNameFor(model => model.Libelle)
+        </dt>
+
+        <dd>
+            @Html.DisplayFor(model => model.Libelle)
+        </dd>
+
+    </dl>
+
+    @using (Html.BeginForm()) {
+        @Html.AntiForgeryToken()
+
+        <div class="form-actions no-color">
+            <input type="submit" value="Supprimer" class="btn btn-default" /> |
+            @Html.ActionLink("Retour à la liste", "Index")
+        </div>
+    }
+</div>

+ 44 - 0
CD67.FicheCollege.MVC/Views/Territoire/Edit.cshtml

@@ -0,0 +1,44 @@
+@model CD67.FicheCollege.Entity.Territoire
+
+@{
+    ViewBag.Title = "Modification";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+<h2>Modification</h2>
+
+
+@using (Html.BeginForm())
+{
+    @Html.AntiForgeryToken()
+    
+    <div class="form-horizontal">
+        <h4>Territoire</h4>
+        <hr />
+        @Html.ValidationSummary(true, "", new { @class = "text-danger" })
+        @Html.HiddenFor(model => model.Id)
+        @Html.HiddenFor(model => model.Ordre)
+
+        <div class="form-group">
+            @Html.LabelFor(model => model.Libelle, htmlAttributes: new { @class = "control-label col-md-2" })
+            <div class="col-md-10">
+                @Html.EditorFor(model => model.Libelle, new { htmlAttributes = new { @class = "form-control" } })
+                @Html.ValidationMessageFor(model => model.Libelle, "", new { @class = "text-danger" })
+            </div>
+        </div>
+
+        <div class="form-group">
+            <div class="col-md-offset-2 col-md-10">
+                <input type="submit" value="Enregistrer" class="btn btn-default" />
+            </div>
+        </div>
+    </div>
+}
+
+<div>
+    @Html.ActionLink("Retour à la liste", "Index")
+</div>
+
+@section Scripts {
+    @Scripts.Render("~/bundles/jqueryval")
+}

+ 66 - 0
CD67.FicheCollege.MVC/Views/Territoire/Index.cshtml

@@ -0,0 +1,66 @@
+@model IEnumerable<CD67.FicheCollege.Entity.Territoire>
+
+@{
+    ViewBag.Title = "Liste";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+    int maxOrdre = Model.Count() == 0 ? 0 : Model.Max(i => i.Ordre);
+    int row = 1;
+}
+
+<h2>Liste</h2>
+
+<p>
+    <a href="@Url.Action("Create")">
+        <span class="glyphicon glyphicon-plus-sign fa-2x color1" style="vertical-align: middle" aria-hidden="true"></span>
+        Créer un nouvel élément
+    </a>
+</p>
+
+<table class="table">
+    <tr>
+        <th>
+            @Html.DisplayNameFor(model => model.Libelle)
+        </th>
+        <th></th>
+    </tr>
+
+@foreach (var item in Model)
+{
+    <tr>
+        <td>
+            @Html.DisplayFor(modelItem => item.Libelle)
+        </td>
+        
+        <td>
+            @if (row != 1)
+                {
+                <a href="@Url.Action("Up", new { id = item.Id })">
+                    <span class="glyphicon glyphicon-circle-arrow-up fa-2x color1" title="Remonter" style="vertical-align: middle" aria-hidden="true"></span>
+                </a>
+            }
+            else
+            {
+                <span class="glyphicon glyphicon-circle-arrow-up fa-2x color2" title="Remonter" style="vertical-align: middle" aria-hidden="true"></span>
+            }
+            @if (item.Ordre != maxOrdre)
+                {
+                <a href="@Url.Action("Down", new { id = item.Id })">
+                    <span class="glyphicon glyphicon-circle-arrow-down fa-2x color1" title="Descendre" style="vertical-align: middle" aria-hidden="true"></span>
+                </a>
+            }
+            else
+            {
+                <span class="glyphicon glyphicon-circle-arrow-down fa-2x color2" title="Descendre" style="vertical-align: middle" aria-hidden="true"></span>
+            }
+            <a href="@Url.Action("Edit", new { id = item.Id })">
+                <span class="glyphicon glyphicon-edit fa-2x color1" title="Modifier" style="vertical-align: middle" aria-hidden="true"></span>
+            </a>
+            <a href="@Url.Action("Delete", new { id = item.Id })">
+                <span class="glyphicon glyphicon-remove-sign fa-2x color1" title="Supprimer" style="vertical-align: middle" aria-hidden="true"></span>
+            </a>
+        </td>
+    </tr>
+    row += 1;
+}
+
+</table>

+ 44 - 0
CD67.FicheCollege.MVC/Views/TypeCollege/Create.cshtml

@@ -0,0 +1,44 @@
+@model CD67.FicheCollege.Entity.TypeCollege
+
+@{
+    ViewBag.Title = "Création";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+<h2>Création</h2>
+
+
+@using (Html.BeginForm()) 
+{
+    @Html.AntiForgeryToken()
+    
+    <div class="form-horizontal">
+        <h4>Type collège</h4>
+        <hr />
+        @Html.ValidationSummary(true, "", new { @class = "text-danger" })
+        @Html.HiddenFor(model => model.Id)
+        @Html.HiddenFor(model => model.Ordre)
+
+        <div class="form-group">
+            @Html.LabelFor(model => model.Libelle, htmlAttributes: new { @class = "control-label col-md-2" })
+            <div class="col-md-10">
+                @Html.EditorFor(model => model.Libelle, new { htmlAttributes = new { @class = "form-control" } })
+                @Html.ValidationMessageFor(model => model.Libelle, "", new { @class = "text-danger" })
+            </div>
+        </div>
+
+        <div class="form-group">
+            <div class="col-md-offset-2 col-md-10">
+                <input type="submit" value="Créer" class="btn btn-default" />
+            </div>
+        </div>
+    </div>
+}
+
+<div>
+    @Html.ActionLink("Retour à la liste", "Index")
+</div>
+
+@section Scripts {
+    @Scripts.Render("~/bundles/jqueryval")
+}

+ 33 - 0
CD67.FicheCollege.MVC/Views/TypeCollege/Delete.cshtml

@@ -0,0 +1,33 @@
+@model CD67.FicheCollege.Entity.TypeCollege
+
+@{
+    ViewBag.Title = "Suppression";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+<h2>Suppression</h2>
+
+<h3>Voulez-vous vraiment supprimer cet élément?</h3>
+<div>
+    <h4>Type collège</h4>
+    <hr />
+    <dl class="dl-horizontal">
+        <dt>
+            @Html.DisplayNameFor(model => model.Libelle)
+        </dt>
+
+        <dd>
+            @Html.DisplayFor(model => model.Libelle)
+        </dd>
+
+    </dl>
+
+    @using (Html.BeginForm()) {
+        @Html.AntiForgeryToken()
+
+        <div class="form-actions no-color">
+            <input type="submit" value="Supprimer" class="btn btn-default" /> |
+            @Html.ActionLink("Retour à la liste", "Index")
+        </div>
+    }
+</div>

+ 44 - 0
CD67.FicheCollege.MVC/Views/TypeCollege/Edit.cshtml

@@ -0,0 +1,44 @@
+@model CD67.FicheCollege.Entity.TypeCollege
+
+@{
+    ViewBag.Title = "Modification";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+<h2>Modification</h2>
+
+
+@using (Html.BeginForm())
+{
+    @Html.AntiForgeryToken()
+    
+    <div class="form-horizontal">
+        <h4>Type collège</h4>
+        <hr />
+        @Html.ValidationSummary(true, "", new { @class = "text-danger" })
+        @Html.HiddenFor(model => model.Id)
+        @Html.HiddenFor(model => model.Ordre)
+
+        <div class="form-group">
+            @Html.LabelFor(model => model.Libelle, htmlAttributes: new { @class = "control-label col-md-2" })
+            <div class="col-md-10">
+                @Html.EditorFor(model => model.Libelle, new { htmlAttributes = new { @class = "form-control" } })
+                @Html.ValidationMessageFor(model => model.Libelle, "", new { @class = "text-danger" })
+            </div>
+        </div>
+
+        <div class="form-group">
+            <div class="col-md-offset-2 col-md-10">
+                <input type="submit" value="Enregistrer" class="btn btn-default" />
+            </div>
+        </div>
+    </div>
+}
+
+<div>
+    @Html.ActionLink("Retour à la liste", "Index")
+</div>
+
+@section Scripts {
+    @Scripts.Render("~/bundles/jqueryval")
+}

+ 66 - 0
CD67.FicheCollege.MVC/Views/TypeCollege/Index.cshtml

@@ -0,0 +1,66 @@
+@model IEnumerable<CD67.FicheCollege.Entity.TypeCollege>
+
+@{
+    ViewBag.Title = "Liste";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+    int maxOrdre = Model.Count() == 0 ? 0 : Model.Max(i => i.Ordre);
+    int row = 1;
+}
+
+<h2>Liste</h2>
+
+<p>
+    <a href="@Url.Action("Create")">
+        <span class="glyphicon glyphicon-plus-sign fa-2x color1" style="vertical-align: middle" aria-hidden="true"></span>
+        Créer un nouvel élément
+    </a>
+</p>
+
+<table class="table">
+    <tr>
+        <th>
+            @Html.DisplayNameFor(model => model.Libelle)
+        </th>
+        <th></th>
+    </tr>
+
+@foreach (var item in Model)
+{
+    <tr>
+        <td>
+            @Html.DisplayFor(modelItem => item.Libelle)
+        </td>
+        
+        <td>
+            @if (row != 1)
+                {
+                <a href="@Url.Action("Up", new { id = item.Id })">
+                    <span class="glyphicon glyphicon-circle-arrow-up fa-2x color1" title="Remonter" style="vertical-align: middle" aria-hidden="true"></span>
+                </a>
+            }
+            else
+            {
+                <span class="glyphicon glyphicon-circle-arrow-up fa-2x color2" title="Remonter" style="vertical-align: middle" aria-hidden="true"></span>
+            }
+            @if (item.Ordre != maxOrdre)
+                {
+                <a href="@Url.Action("Down", new { id = item.Id })">
+                    <span class="glyphicon glyphicon-circle-arrow-down fa-2x color1" title="Descendre" style="vertical-align: middle" aria-hidden="true"></span>
+                </a>
+            }
+            else
+            {
+                <span class="glyphicon glyphicon-circle-arrow-down fa-2x color2" title="Descendre" style="vertical-align: middle" aria-hidden="true"></span>
+            }
+            <a href="@Url.Action("Edit", new { id = item.Id })">
+                <span class="glyphicon glyphicon-edit fa-2x color1" title="Modifier" style="vertical-align: middle" aria-hidden="true"></span>
+            </a>
+            <a href="@Url.Action("Delete", new { id = item.Id })">
+                <span class="glyphicon glyphicon-remove-sign fa-2x color1" title="Supprimer" style="vertical-align: middle" aria-hidden="true"></span>
+            </a>
+        </td>
+    </tr>
+    row += 1;
+}
+
+</table>

+ 1 - 1
CD67.FicheCollege.MVC/Web.config

@@ -9,7 +9,7 @@
     <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
   </configSections>
   <connectionStrings>
-    <add name="ModeleMVCEntities" connectionString="metadata=res://*/EntityModel.csdl|res://*/EntityModel.ssdl|res://*/EntityModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=T-MSSQL-02\SQLSTD2K14;initial catalog=FicheCollege;persist security info=True;user id=FicheCollege_admin;password=bk9JFwqSwYw7mEPiOhnu;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
+    <add name="Entities" connectionString="metadata=res://*/EntityModel.csdl|res://*/EntityModel.ssdl|res://*/EntityModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=T-MSSQL-02\SQLSTD2K14;initial catalog=FicheCollege;persist security info=True;user id=FicheCollege_admin;password=bk9JFwqSwYw7mEPiOhnu;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
   </connectionStrings>
   <appSettings>
     <add key="webpages:Version" value="2.0.0.0" />