olivier.massot vor 7 Jahren
Ursprung
Commit
efcdfa98ec

+ 1 - 1
CD67.FicheCollege.Entity/Extend/ActionEduAxe.cs

@@ -28,7 +28,7 @@ namespace CD67.FicheCollege.Entity
         public string Nom { get; set; }
 
         [Display(Name = "Neutralisé (oui/non)")]
-        public bool Neutralise { get; set; }
+        public bool? Neutralise { get; set; }
 
         public int Ordre { get; set; }
     }

+ 26 - 43
CD67.FicheCollege.MVC/Controllers/ActionEduAxesController.cs

@@ -18,29 +18,12 @@ namespace CD67.FicheCollege.MVC.Controllers
             return View(model);
         }
 
-        // GET: ActionEduAxe/Details/5
-        public ActionResult Details(int? id)
-        {
-            if (id == null)
-            {
-                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
-            }
-            ActionEduAxeFactory ActionEduAxeFactory = new ActionEduAxeFactory(db);
-            Entity.ActionEduAxe ActionEduAxe = ActionEduAxeFactory.getById(id.Value);
-            if (ActionEduAxe == null)
-            {
-                return HttpNotFound();
-            }
-            ActionEduAxeViewModel model = new ActionEduAxeViewModel(ActionEduAxe);
-            return View(model);
-        }
-
         // GET: ActionEduAxe/Create
         public ActionResult Create()
         {
-            ActionEduAxe ActionEduAxe = new ActionEduAxe();
+            ActionEduAxe axe = new ActionEduAxe();
 
-            ActionEduAxeViewModel model = new ActionEduAxeViewModel(ActionEduAxe);
+            ActionEduAxeViewModel model = new ActionEduAxeViewModel(axe);
             return View(model);
         }
 
@@ -49,16 +32,16 @@ namespace CD67.FicheCollege.MVC.Controllers
         // plus de détails, voir  http://go.microsoft.com/fwlink/?LinkId=317598.
         [HttpPost]
         [ValidateAntiForgeryToken]
-        public ActionResult Create(ActionEduAxe ActionEduAxe)
+        public ActionResult Create(ActionEduAxe axe)
         {
             if (ModelState.IsValid)
             {
                 ActionEduAxeFactory ActionEduAxeFactory = new ActionEduAxeFactory(db);
-                ActionEduAxeFactory.add(ref ActionEduAxe);
+                ActionEduAxeFactory.add(ref axe);
                 return RedirectToAction("Index");
             }
 
-            ActionEduAxeViewModel model = new ActionEduAxeViewModel(ActionEduAxe);
+            ActionEduAxeViewModel model = new ActionEduAxeViewModel(axe);
             return View(model);
         }
 
@@ -69,13 +52,13 @@ namespace CD67.FicheCollege.MVC.Controllers
             {
                 return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
             }
-            ActionEduAxeFactory ActionEduAxeFactory = new ActionEduAxeFactory(db);
-            Entity.ActionEduAxe ActionEduAxe = ActionEduAxeFactory.getById(id.Value);
-            if (ActionEduAxe == null)
+            ActionEduAxeFactory fact = new ActionEduAxeFactory(db);
+            ActionEduAxe axe = fact.getById(id.Value);
+            if (axe == null)
             {
                 return HttpNotFound();
             }
-            ActionEduAxeViewModel model = new ActionEduAxeViewModel(ActionEduAxe);
+            ActionEduAxeViewModel model = new ActionEduAxeViewModel(axe);
             return View(model);
         }
 
@@ -84,15 +67,15 @@ namespace CD67.FicheCollege.MVC.Controllers
         // plus de détails, voir  http://go.microsoft.com/fwlink/?LinkId=317598.
         [HttpPost]
         [ValidateAntiForgeryToken]
-        public ActionResult Edit(ActionEduAxe ActionEduAxe)
+        public ActionResult Edit(ActionEduAxe axe)
         {
             if (ModelState.IsValid)
             {
-                ActionEduAxeFactory ActionEduAxeFactory = new ActionEduAxeFactory(db);
-                ActionEduAxeFactory.update(ref ActionEduAxe);
+                ActionEduAxeFactory fact = new ActionEduAxeFactory(db);
+                fact.update(ref axe);
                 return RedirectToAction("Index");
             }
-            ActionEduAxeViewModel model = new ActionEduAxeViewModel(ActionEduAxe);
+            ActionEduAxeViewModel model = new ActionEduAxeViewModel(axe);
             return View(model);
         }
 
@@ -103,13 +86,13 @@ namespace CD67.FicheCollege.MVC.Controllers
             {
                 return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
             }
-            ActionEduAxeFactory ActionEduAxeFactory = new ActionEduAxeFactory(db);
-            Entity.ActionEduAxe ActionEduAxe = ActionEduAxeFactory.getById(id.Value);
-            if (ActionEduAxe == null)
+            ActionEduAxeFactory fact = new ActionEduAxeFactory(db);
+            ActionEduAxe axe = fact.getById(id.Value);
+            if (axe == null)
             {
                 return HttpNotFound();
             }
-            ActionEduAxeViewModel model = new ActionEduAxeViewModel(ActionEduAxe);
+            ActionEduAxeViewModel model = new ActionEduAxeViewModel(axe);
             return View(model);
         }
 
@@ -118,9 +101,9 @@ namespace CD67.FicheCollege.MVC.Controllers
         [ValidateAntiForgeryToken]
         public ActionResult DeleteConfirmed(int id)
         {
-            ActionEduAxeFactory ActionEduAxeFactory = new ActionEduAxeFactory(db);
-            Entity.ActionEduAxe ActionEduAxe = ActionEduAxeFactory.getById(id);
-            ActionEduAxeFactory.delete(ref ActionEduAxe);
+            ActionEduAxeFactory fact = new ActionEduAxeFactory(db);
+            ActionEduAxe axe = fact.getById(id);
+            fact.delete(ref axe);
             return RedirectToAction("Index");
         }
 
@@ -130,9 +113,9 @@ namespace CD67.FicheCollege.MVC.Controllers
             {
                 return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
             }
-            ActionEduAxeFactory ActionEduAxeFactory = new ActionEduAxeFactory(db);
-            Entity.ActionEduAxe ActionEduAxe = ActionEduAxeFactory.getById(id.Value);
-            ActionEduAxeFactory.Up(ref ActionEduAxe);
+            ActionEduAxeFactory fact = new ActionEduAxeFactory(db);
+            ActionEduAxe axe = fact.getById(id.Value);
+            fact.Up(ref axe);
             return RedirectToAction("Index");
         }
 
@@ -142,9 +125,9 @@ namespace CD67.FicheCollege.MVC.Controllers
             {
                 return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
             }
-            ActionEduAxeFactory ActionEduAxeFactory = new ActionEduAxeFactory(db);
-            Entity.ActionEduAxe ActionEduAxe = ActionEduAxeFactory.getById(id.Value);
-            ActionEduAxeFactory.Down(ref ActionEduAxe);
+            ActionEduAxeFactory fact = new ActionEduAxeFactory(db);
+            ActionEduAxe axe = fact.getById(id.Value);
+            fact.Down(ref axe);
             return RedirectToAction("Index");
         }
 

+ 8 - 0
CD67.FicheCollege.MVC/Views/ActionEduAxes/Create.cshtml

@@ -27,6 +27,14 @@
             </div>
         </div>
 
+        <div class="form-group">
+            @Html.LabelFor(model => axe.Neutralise, htmlAttributes: new { @class = "control-label col-md-2" })
+            <div class="col-md-10">
+                @Html.EditorFor(model => axe.Neutralise, new { htmlAttributes = new { @class = "form-control" } })
+                @Html.ValidationMessageFor(model => axe.Neutralise, "", 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" />

+ 1 - 1
CD67.FicheCollege.MVC/Views/ActionEduAxes/Delete.cshtml

@@ -11,7 +11,7 @@
 
 <h3>Voulez-vous vraiment supprimer cet élément?</h3>
 <div>
-    <h4>Type collège</h4>
+    <h4>Axe</h4>
     <hr />
     <dl class="dl-horizontal">
         <dt>

+ 9 - 1
CD67.FicheCollege.MVC/Views/ActionEduAxes/Edit.cshtml

@@ -15,7 +15,7 @@
     @Html.AntiForgeryToken()
     
     <div class="form-horizontal">
-        <h4>Type collège</h4>
+        <h4>Axe</h4>
         <hr />
         @Html.ValidationSummary(true, "", new { @class = "text-danger" })
         @Html.HiddenFor(model => axe.Id)
@@ -29,6 +29,14 @@
             </div>
         </div>
 
+        <div class="form-group">
+            @Html.LabelFor(model => axe.Neutralise, htmlAttributes: new { @class = "control-label col-md-2" })
+            <div class="col-md-10">
+                @Html.EditorFor(model => axe.Neutralise, new { htmlAttributes = new { @class = "form-control" } })
+                @Html.ValidationMessageFor(model => axe.Neutralise, "", 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" />

+ 8 - 1
CD67.FicheCollege.MVC/Views/ActionEduAxes/Index.cshtml

@@ -20,7 +20,10 @@
 <table class="table">
     <tr>
         <th>
-            @*@Html.DisplayNameFor(model => model.Obj.Libelle)*@
+            @Html.DisplayNameFor(model => model.Obj.First().Nom)
+        </th>
+        <th>
+            @Html.DisplayNameFor(model => model.Obj.First().Neutralise)
         </th>
         <th></th>
     </tr>
@@ -32,6 +35,10 @@
                 @Html.DisplayFor(modelItem => item.Nom)
             </td>
         
+            <td>
+                @Html.DisplayFor(modelItem => item.Neutralise)
+            </td>
+
             <td>
                 @if (row != 1)
                     {