From ca46333383a00ff48c3e443fca010a3a2bf05368 Mon Sep 17 00:00:00 2001
From: Dan <daniel2.lorych@live.uwe.ac.uk>
Date: Mon, 2 May 2022 10:53:44 +0100
Subject: [PATCH] Add initial view for ConfiguratorResults

---
 Helios/Controllers/ConfiguratorController.cs  |  6 +-
 Helios/Models/ConfiguratorResult.cs           | 16 +++++
 .../Configurator/ConfiguratorResult.cshtml    | 60 +++++++++++++++++++
 Helios/Views/Configurator/Index.cshtml        |  2 +-
 4 files changed, 80 insertions(+), 4 deletions(-)
 create mode 100644 Helios/Views/Configurator/ConfiguratorResult.cshtml

diff --git a/Helios/Controllers/ConfiguratorController.cs b/Helios/Controllers/ConfiguratorController.cs
index ac9b7e0..0fcb1b0 100644
--- a/Helios/Controllers/ConfiguratorController.cs
+++ b/Helios/Controllers/ConfiguratorController.cs
@@ -24,11 +24,11 @@ namespace Helios.Controllers
             return View();
         }
 
-        public ActionResult SubmitSystem(ConfiguratorInput input)
+        public ActionResult ConfiguratorResult(ConfiguratorInput input)
         {
-            _service.GetResults(input);
+            var model = _service.GetResults(input);
 
-            return View("Index");
+            return View(model);
         }
 
     }
diff --git a/Helios/Models/ConfiguratorResult.cs b/Helios/Models/ConfiguratorResult.cs
index c94ba9b..8796804 100644
--- a/Helios/Models/ConfiguratorResult.cs
+++ b/Helios/Models/ConfiguratorResult.cs
@@ -1,16 +1,32 @@
 using System;
+using System.ComponentModel;
+
 namespace Helios.Models
 {
 	public class ConfiguratorResult
 	{
         public double RoofArea { get; set; }
         public double RoofAngle { get; set; }
+
+        [DisplayName("Panel Efficiency")]
         public double PanelEfficiency { get; set; }
+
+        [DisplayName("Installation Cost")]
         public double InstallationCost { get; set; }
+
+        [DisplayName("Power Generated in Summer")]
         public double PowerGeneratedSummer { get; set; }
+
+        [DisplayName("Power Generated in Winter")]
         public double PowerGeneratedWinter { get; set; }
+
+        [DisplayName("Meets Energy Requirement")]
         public bool GeneratesRequiredPower { get; set; }
+
+        [DisplayName("Exceeds Max Power")]
         public bool ExceedsMaximumPower { get; set; }
+
+        [DisplayName("Is Within Budget")]
         public bool WithinBudget { get; set; }
 
         public ConfiguratorResult()
diff --git a/Helios/Views/Configurator/ConfiguratorResult.cshtml b/Helios/Views/Configurator/ConfiguratorResult.cshtml
new file mode 100644
index 0000000..74267a6
--- /dev/null
+++ b/Helios/Views/Configurator/ConfiguratorResult.cshtml
@@ -0,0 +1,60 @@
+@model IEnumerable<Helios.Models.ConfiguratorResult>
+
+@{
+    ViewData["Title"] = "Configuration Results";
+}
+
+<table class="table">
+    <tr>
+        <th>
+            @Html.DisplayNameFor(model => model.PanelEfficiency)
+        </th>
+        <th>
+            @Html.DisplayNameFor(model => model.InstallationCost)
+        </th>
+        <th>
+            @Html.DisplayNameFor(model => model.PowerGeneratedSummer)
+        </th>
+        <th>
+            @Html.DisplayNameFor(model => model.PowerGeneratedWinter)
+        </th>
+        <th>
+            @Html.DisplayNameFor(model => model.GeneratesRequiredPower)
+        </th>
+        <th>
+            @Html.DisplayNameFor(model => model.ExceedsMaximumPower)
+        </th>
+        <th>
+            @Html.DisplayNameFor(model => model.WithinBudget)
+        </th>
+        <th></th>
+    </tr>
+
+    @foreach (var item in Model)
+    {
+        <tr>
+            <td>
+                @Html.DisplayFor(modelItem => item.PanelEfficiency)
+            </td>
+            <td>
+                @Html.DisplayFor(modelItem => item.InstallationCost)
+            </td>
+            <td>
+                @Html.DisplayFor(modelItem => item.PowerGeneratedSummer)
+            </td>
+            <td>
+                @Html.DisplayFor(modelItem => item.PowerGeneratedWinter)
+            </td>
+            <td>
+                @Html.DisplayFor(modelItem => item.GeneratesRequiredPower)
+            </td>
+            <td>
+                @Html.DisplayFor(modelItem => item.ExceedsMaximumPower)
+            </td>
+            <td>
+                @Html.DisplayFor(modelItem => item.WithinBudget)
+            </td>
+        </tr>
+    }
+
+</table>
\ No newline at end of file
diff --git a/Helios/Views/Configurator/Index.cshtml b/Helios/Views/Configurator/Index.cshtml
index e95c488..e699b9e 100644
--- a/Helios/Views/Configurator/Index.cshtml
+++ b/Helios/Views/Configurator/Index.cshtml
@@ -4,7 +4,7 @@
     ViewData["Title"] = "Configuration Page";
 }
 
-@using (Html.BeginForm(actionName: "SubmitSystem", controllerName: "Configurator", Model))
+@using (Html.BeginForm(actionName: "ConfiguratorResult", controllerName: "Configurator", Model))
 {
 <div class="form-horizontal">
     <h4>Configurator Input</h4>
-- 
GitLab