a
This commit is contained in:
@@ -13,12 +13,14 @@ public class ServerController : Controller
|
|||||||
|
|
||||||
private readonly ILogger<ServerController> _logger;
|
private readonly ILogger<ServerController> _logger;
|
||||||
|
|
||||||
|
|
||||||
public ServerController(AppDbContext context, ILogger<ServerController> logger)
|
public ServerController(AppDbContext context, ILogger<ServerController> logger)
|
||||||
{
|
{
|
||||||
_context = context;
|
_context = context;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[HttpGet("Overview")]
|
[HttpGet("Overview")]
|
||||||
public async Task<IActionResult> Overview()
|
public async Task<IActionResult> Overview()
|
||||||
{
|
{
|
||||||
@@ -30,15 +32,17 @@ public class ServerController : Controller
|
|||||||
return View(vm);
|
return View(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[HttpGet("AddServer")]
|
[HttpGet("AddServer")]
|
||||||
public IActionResult AddServer()
|
public IActionResult AddServer()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("AddServer")]
|
// POST: Server/AddServer
|
||||||
|
[HttpPost("CreateServer")]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> AddServer(AddServerViewModel vm)
|
public async Task<IActionResult> CreateServer(AddServerViewModel vm)
|
||||||
{
|
{
|
||||||
if (!ModelState.IsValid)
|
if (!ModelState.IsValid)
|
||||||
return View(vm);
|
return View(vm);
|
||||||
@@ -59,6 +63,7 @@ public class ServerController : Controller
|
|||||||
return RedirectToAction("Overview");
|
return RedirectToAction("Overview");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// POST: Server/Delete/5
|
||||||
[HttpPost("Delete")]
|
[HttpPost("Delete")]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
public async Task<IActionResult> Delete(int id)
|
public async Task<IActionResult> Delete(int id)
|
||||||
@@ -78,8 +83,9 @@ public class ServerController : Controller
|
|||||||
return RedirectToAction(nameof(Overview));
|
return RedirectToAction(nameof(Overview));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// GET: Server/Edit/5
|
// GET: Server/Edit/5
|
||||||
[HttpGet("EditServer/[id]")]
|
[HttpGet("EditServer/{id}")]
|
||||||
public async Task<IActionResult> EditServer(int id)
|
public async Task<IActionResult> EditServer(int id)
|
||||||
{
|
{
|
||||||
var server = await _context.Servers.FindAsync(id);
|
var server = await _context.Servers.FindAsync(id);
|
||||||
@@ -95,6 +101,7 @@ public class ServerController : Controller
|
|||||||
return View(vm);
|
return View(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// POST: Server/Edit/5
|
// POST: Server/Edit/5
|
||||||
[HttpPost("EditServer/{id}")]
|
[HttpPost("EditServer/{id}")]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
@@ -129,6 +136,7 @@ public class ServerController : Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// GET: Server/Details/5
|
// GET: Server/Details/5
|
||||||
[HttpGet("Details/{id}")]
|
[HttpGet("Details/{id}")]
|
||||||
public async Task<IActionResult> Details(int id)
|
public async Task<IActionResult> Details(int id)
|
||||||
@@ -157,6 +165,7 @@ public class ServerController : Controller
|
|||||||
return View(vm);
|
return View(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[HttpGet("ServerCardPartial")]
|
[HttpGet("ServerCardPartial")]
|
||||||
public async Task<IActionResult> ServerCardsPartial()
|
public async Task<IActionResult> ServerCardsPartial()
|
||||||
{
|
{
|
||||||
@@ -171,6 +180,7 @@ public class ServerController : Controller
|
|||||||
return PartialView("_ServerCard", servers);
|
return PartialView("_ServerCard", servers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[HttpGet("ServerDetailPartial")]
|
[HttpGet("ServerDetailPartial")]
|
||||||
public IActionResult ServerDetailPartial()
|
public IActionResult ServerDetailPartial()
|
||||||
{
|
{
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
<i class="bi bi-plus-circle me-2"></i>Neuen Server hinzufügen
|
<i class="bi bi-plus-circle me-2"></i>Neuen Server hinzufügen
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<form asp-action="AddServer" asp-controller="Server" method="post">
|
<form asp-action="CreateServer" asp-controller="Server" method="post">
|
||||||
@Html.AntiForgeryToken()
|
@Html.AntiForgeryToken()
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label asp-for="Name" class="form-label"><i class="bi bi-terminal me-1"></i>Servername</label>
|
<label asp-for="Name" class="form-label"><i class="bi bi-terminal me-1"></i>Servername</label>
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<h1 class="h2 fw-bold mb-0">
|
<h1 class="h2 fw-bold mb-0">
|
||||||
<i class="bi bi-hdd-network me-2 text-primary"></i>Serverübersicht
|
<i class="bi bi-hdd-network me-2 text-primary"></i>Serverübersicht
|
||||||
</h1>
|
</h1>
|
||||||
<a asp-controller="Server" asp-action="AddServer" class="btn btn-primary d-flex align-items-center gap-1">
|
<a asp-controller="Server" asp-action="AddServer" method="get" class="btn btn-primary d-flex align-items-center gap-1">
|
||||||
<i class="bi bi-plus-circle"></i> Server hinzufügen
|
<i class="bi bi-plus-circle"></i> Server hinzufügen
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user