MVC-databaskonstruktion

Log | Files | Refs | README

commit a0e84ba293e60aa4e0112ea23795f47e02d10e23
parent a136bd42d9e2fb95b289260170a121b8e8b242e7
Author: William Lindholm <william_lindholm@outlook.com>
Date:   Sat, 14 Oct 2023 20:18:57 +0200

General UI improvements

Diffstat:
MMVC-databaskonstruktion/Controllers/AgentsController.cs | 1-
MMVC-databaskonstruktion/Views/Agents/index.cshtml | 12++++++++++++
MMVC-databaskonstruktion/Views/Shared/_TablePartial.cshtml | 99++++++++++++++++++++++++++++++++++++++++---------------------------------------
3 files changed, 62 insertions(+), 50 deletions(-)

diff --git a/MVC-databaskonstruktion/Controllers/AgentsController.cs b/MVC-databaskonstruktion/Controllers/AgentsController.cs @@ -1,6 +1,5 @@ using Microsoft.AspNetCore.Mvc; using MVC_databaskonstruktion.Models; -using MVC_databaskonstruktion.Utils; using MySql.Data.MySqlClient; using System.Diagnostics; diff --git a/MVC-databaskonstruktion/Views/Agents/index.cshtml b/MVC-databaskonstruktion/Views/Agents/index.cshtml @@ -10,4 +10,15 @@ <partial name="_TablePartial" model="ViewBag.Managers" /> <hr /> +<label class="mt-1">Hire agent:</label> +<br /> <partial name="_ModalPartial" model="ViewBag.CreateAgentModal" /> +<hr /> + +<form action="@Url.Action("Delete")" method="get" class="mt-1"> + <label>Delete Agent:</label> + <br /> + <input type="text" name="CodeName" placeholder="CodeName" class="form-control d-inline-block" style="vertical-align: middle; width: auto;" /> + <input name="table" type="hidden" value="Agent" /> + <button type="submit" class="btn btn-danger ml-2">Delete</button> +</form> +\ No newline at end of file diff --git a/MVC-databaskonstruktion/Views/Shared/_TablePartial.cshtml b/MVC-databaskonstruktion/Views/Shared/_TablePartial.cshtml @@ -7,61 +7,63 @@ var deleteQuery = new RouteValueDictionary(); } -<table class="table table-striped table-bordered"> - <thead class="table-dark"> - <tr> - @foreach (System.Data.DataColumn column in dataTable.Columns) - { - <th scope="col"> - @column.ColumnName - </th> - } - @if (!string.IsNullOrEmpty(Model.Redirect)) - { - <th scope="col"> - Details - </th> - } - @if (!string.IsNullOrEmpty(Model.DeleteTable)) - { - <th scope="col"> - Delete - </th> - } - </tr> - </thead> - <tbody> - @foreach (System.Data.DataRow row in dataTable.Rows) - { +<div class="overflow-scroll w-100"> + <table class="table table-striped table-bordered"> + <thead class="table-dark"> <tr> - @for (int col = 0; col < dataTable.Columns.Count; col++) - { - <td> - @row[col] - </td> - } - @if (Model.PrimaryKeys?.Count > 0) + @foreach (System.Data.DataColumn column in dataTable.Columns) { - foreach (var key in Model.PrimaryKeys) - { - urlQuery[key] = row[key]; - } - deleteQuery = new RouteValueDictionary(urlQuery); - deleteQuery["Table"] = Model.DeleteTable; + <th scope="col"> + @column.ColumnName + </th> } @if (!string.IsNullOrEmpty(Model.Redirect)) { - <td> - @Html.ActionLink("Details", Model.Redirect, Model.ControllerName, urlQuery, new { @class = "btn btn-info" }) - </td> + <th scope="col" class="col-1"> + Details + </th> } @if (!string.IsNullOrEmpty(Model.DeleteTable)) { - <td> - @Html.ActionLink("Delete", "Delete", Model.ControllerName, deleteQuery, new { @class = "btn btn-danger" }) - </td> + <th scope="col" class="col-1"> + Delete + </th> } </tr> - } - </tbody> -</table> -\ No newline at end of file + </thead> + <tbody> + @foreach (System.Data.DataRow row in dataTable.Rows) + { + <tr> + @for (int col = 0; col < dataTable.Columns.Count; col++) + { + <td> + @row[col] + </td> + } + @if (Model.PrimaryKeys?.Count > 0) + { + foreach (var key in Model.PrimaryKeys) + { + urlQuery[key] = row[key]; + } + deleteQuery = new RouteValueDictionary(urlQuery); + deleteQuery["Table"] = Model.DeleteTable; + } + @if (!string.IsNullOrEmpty(Model.Redirect)) + { + <td class="col-1"> + @Html.ActionLink("Details", Model.Redirect, Model.ControllerName, urlQuery, new { @class = "btn btn-block btn-info m-0 w-100" }) + </td> + } + @if (!string.IsNullOrEmpty(Model.DeleteTable)) + { + <td class="col-1"> + @Html.ActionLink("Delete", "Delete", Model.ControllerName, deleteQuery, new { @class = "btn btn-block btn-danger m-0 w-100" }) + </td> + } + </tr> + } + </tbody> + </table> +</div>