Remove details action. Rename Create action to Add

dashboard
Pat Hartl 2023-01-04 00:40:31 -06:00
parent 2fc43f3f34
commit bbdb1dcb7a
4 changed files with 4 additions and 89 deletions

View File

@ -29,26 +29,8 @@ namespace LANCommander.Controllers
Problem("Entity set 'DatabaseContext.Games' is null."); Problem("Entity set 'DatabaseContext.Games' is null.");
} }
// GET: Games/Details/5
public async Task<IActionResult> Details(Guid? id)
{
if (id == null || Context.Games == null)
{
return NotFound();
}
var game = await Context.Games
.FirstOrDefaultAsync(m => m.Id == id);
if (game == null)
{
return NotFound();
}
return View(game);
}
// GET: Games/Create // GET: Games/Create
public IActionResult Create() public IActionResult Add()
{ {
return View(); return View();
} }
@ -58,7 +40,7 @@ namespace LANCommander.Controllers
// For more details, see http://go.microsoft.com/fwlink/?LinkId=317598. // For more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost] [HttpPost]
[ValidateAntiForgeryToken] [ValidateAntiForgeryToken]
public async Task<IActionResult> Create([Bind("Title,SortTitle,Description,ReleasedOn,Id,CreatedOn,CreatedById,UpdatedOn,UpdatedById")] Game game) public async Task<IActionResult> Add([Bind("Title,SortTitle,Description,ReleasedOn,Id,CreatedOn,CreatedById,UpdatedOn,UpdatedById")] Game game)
{ {
if (ModelState.IsValid) if (ModelState.IsValid)
{ {

View File

@ -1,66 +0,0 @@
@model LANCommander.Data.Models.Game
@{
ViewData["Title"] = "Details";
}
<h1>Details</h1>
<div>
<h4>Game</h4>
<hr />
<dl class="row">
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.Title)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.Title)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.SortTitle)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.SortTitle)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.Description)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.Description)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.ReleasedOn)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.ReleasedOn)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.CreatedOn)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.CreatedOn)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.CreatedBy)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.CreatedBy.UserName)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.UpdatedOn)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.UpdatedOn)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.UpdatedBy)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.UpdatedBy.UserName)
</dd>
</dl>
</div>
<div>
<a asp-action="Edit" asp-route-id="@Model?.Id">Edit</a> |
<a asp-action="Index">Back to List</a>
</div>

View File

@ -14,9 +14,9 @@
<div class="col-auto ms-auto"> <div class="col-auto ms-auto">
<div class="btn-list"> <div class="btn-list">
<a asp-action="Create" class="btn btn-primary d-none d-sm-inline-block"> <a asp-action="Add" class="btn btn-primary d-none d-sm-inline-block">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg> <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>
Create Add
</a> </a>
</div> </div>
</div> </div>
@ -92,7 +92,6 @@
<td> <td>
<div class="btn-list flex-nowrap"> <div class="btn-list flex-nowrap">
<a asp-action="Edit" asp-route-id="@item.Id" class="btn">Edit</a> <a asp-action="Edit" asp-route-id="@item.Id" class="btn">Edit</a>
<a asp-action="Details" asp-route-id="@item.Id" class="btn">Details</a>
<a asp-action="Delete" asp-route-id="@item.Id" class="btn">Delete</a> <a asp-action="Delete" asp-route-id="@item.Id" class="btn">Delete</a>
</div> </div>
</td> </td>