Преглед изворни кода

Refact: Fusion ActionEdu.Details et ActionEdus.Delete

olivier.massot пре 7 година
родитељ
комит
aabbd6beb8

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

@@ -476,7 +476,6 @@
     <Content Include="Views\ActionEduThematiques\Delete.cshtml" />
     <Content Include="Views\ActionEduThematiques\Edit.cshtml" />
     <Content Include="Views\ActionEduThematiques\Index.cshtml" />
-    <Content Include="Views\ActionsEdu\Delete.cshtml" />
     <Content Include="Views\ActionsEdu\Edit.cshtml" />
     <Content Include="Views\ActionsEdu\Index.cshtml" />
     <Content Include="Views\ActionsEdu\Details.cshtml" />

+ 2 - 2
CD67.FicheCollege.MVC/Controllers/ActionsEduController.cs

@@ -133,8 +133,8 @@ namespace CD67.FicheCollege.MVC.Controllers
             {
                 return HttpNotFound();
             }
-            ActionEduViewModel model = new ActionEduViewModel(actionEdu, db);
-            return View(model);
+            ActionEduViewModel model = new ActionEduViewModel(actionEdu, db, ModeAcces.Suppression);
+            return View("Details", model);
         }
 
         // POST: ActionEduAxe/Delete/5

+ 0 - 29
CD67.FicheCollege.MVC/Views/ActionsEdu/Delete.cshtml

@@ -1,29 +0,0 @@
-@using CD67.FicheCollege.MVC.Models
-@model ActionEduViewModel
-
-@{
-    ViewBag.Title = "Suppression";
-    Layout = "~/Views/Shared/_Layout.cshtml";
-    ActionEdu action = Model.Obj;
-}
-
-<header>
-    <h2>Suppression</h2>
-</header>
-
-<h3>Voulez-vous vraiment supprimer cet l'action '@action.Nom'</h3>
-<div>
-    @using (Html.BeginForm()) {
-        @Html.AntiForgeryToken()
-
-        <div class="form-actions no-color">
-            <input type="submit" value="Supprimer" class="btn btn-default" />
-        </div>
-    }
-
-</div>
-
-</br>
-<div>
-    @Html.ActionLink("Annuler", "Details", new { id = action.Id })
-</div>

+ 30 - 2
CD67.FicheCollege.MVC/Views/ActionsEdu/Details.cshtml

@@ -11,6 +11,13 @@
     <h2>@actionEdu.Nom</h2>
 </header>
 
+@if(Model.Acces==ModeAcces.Suppression) {
+    <h2 class="text-danger">Voulez-vous vraiment supprimer cet élément?</h2>
+    <p class="text-danger">
+        Le collège ainsi que toutes les informations liées seront supprimées.
+    </p>
+}
+
 <fieldset>
     <legend>
         Descriptif
@@ -119,7 +126,28 @@
     </table>
 }
 
-<br/>
-@Html.ActionLink("Retour à la liste des actions", "Index", new { annee_id = actionEdu.AnneeId })
+@if (Model.Acces == ModeAcces.Suppression)
+{
+    using (Html.BeginForm())
+    {
+        @Html.AntiForgeryToken()
+
+        <div class="form-actions no-color">
+            <input type="submit" value="@Model.Acces.EnumDisplayNameFor(MvcHtmlHelpers.DisplayValue.Prompt)" class="btn btn-danger" />
+        </div>
+
+        <br/>
+        <div>@Html.ActionLink("Annuler", "Details", new { Id = actionEdu.Id })</div>
+    }
+
+}
+else
+{
+    <div>
+        @Html.ActionLink("Retour à la liste des actions", "Index", new { annee_id = actionEdu.AnneeId })
+    </div>
+}
+
+
 
 

+ 0 - 7
CD67.FicheCollege.MVC/Views/Colleges/Details.cshtml

@@ -207,13 +207,6 @@
     </table>
 </div>
 
-
-
-
-
-
-
-
 @if (Model.Acces == ModeAcces.Suppression)
 {
     using (Html.BeginForm())