InitialCode Commit
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
@page
|
||||
@using MTG_CollectionVerwaltung.Data.MTGCollection
|
||||
@model MTG_CollectionVerwaltung.Pages.Cards.SearchModel
|
||||
@{
|
||||
}
|
||||
|
||||
<div class="container-fluid">
|
||||
<!-- Suchleiste -->
|
||||
<div class="row mb-3">
|
||||
<div class="col-12">
|
||||
<form method="get" asp-page="./Search">
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="query" placeholder="Suche nach Karten..." value="@Model.CurrentQuery" />
|
||||
<button class="btn btn-primary" type="submit">🔍 Suchen</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- Sidebar mit Filtern -->
|
||||
<div class="col-md-3">
|
||||
<div class="card p-3">
|
||||
<h5>Filter</h5>
|
||||
<form method="get" asp-page="./Search">
|
||||
<input type="hidden" name="query" value="@Model.CurrentQuery" />
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Farbe</label>
|
||||
<select class="form-select" name="color">
|
||||
<option value="">Alle</option>
|
||||
<option value="W">Weiß</option>
|
||||
<option value="U">Blau</option>
|
||||
<option value="B">Schwarz</option>
|
||||
<option value="R">Rot</option>
|
||||
<option value="G">Grün</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Seltenheit</label>
|
||||
<select class="form-select" name="rarity">
|
||||
<option value="">Alle</option>
|
||||
<option value="common">Common</option>
|
||||
<option value="uncommon">Uncommon</option>
|
||||
<option value="rare">Rare</option>
|
||||
<option value="mythic">Mythic</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-secondary w-100">Filter anwenden</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Ergebnisse -->
|
||||
<div class="col-md-9">
|
||||
<h2>Suchergebnisse</h2>
|
||||
<div class="resultgrid">
|
||||
@foreach (CardPrinting printing in Model.searchResults)
|
||||
{
|
||||
@await Html.PartialAsync("_CardControl", printing)
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,37 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using MTG_CollectionVerwaltung.Data.MTGCollection;
|
||||
using MTG_CollectionVerwaltung.Helpers;
|
||||
|
||||
namespace MTG_CollectionVerwaltung.Pages.Cards
|
||||
{
|
||||
public class SearchModel : PageModel
|
||||
{
|
||||
public List<CardPrinting> searchResults = new List<CardPrinting>();
|
||||
|
||||
public List<Set> Sets = new List<Set>();
|
||||
|
||||
private readonly ILogger<IndexModel> _logger;
|
||||
|
||||
private readonly MTGContext _context;
|
||||
|
||||
public SearchModel(ILogger<IndexModel> logger, MTGContext mTGContext)
|
||||
{
|
||||
_logger = logger;
|
||||
_context = mTGContext;
|
||||
}
|
||||
|
||||
public string CurrentQuery { get; set; }
|
||||
|
||||
public async Task<IActionResult> OnGet(string Searchquerry)
|
||||
{
|
||||
searchResults = CardSearcher.SearchCards(_context, Searchquerry);
|
||||
|
||||
Sets = _context.Sets.ToList();
|
||||
|
||||
CurrentQuery = Searchquerry;
|
||||
|
||||
return Page();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
@*
|
||||
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
*@
|
||||
@{
|
||||
}
|
||||
<form id="advancedSearch" action="post">
|
||||
|
||||
</form>
|
||||
@@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
@{
|
||||
if (ViewData.TryGetValue("ParentLayout", out var parentLayout) && parentLayout != null)
|
||||
{
|
||||
Layout = parentLayout.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
Layout = "/Pages/Shared/_Layout.cshtml";
|
||||
}
|
||||
}
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<title>@ViewBag.Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="row">
|
||||
@RenderBody()
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@section Scripts {
|
||||
@RenderSection("Scripts", required: false)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
@{
|
||||
Layout = "/Pages/Shared/_Layout.cshtml";
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
@page
|
||||
@model ErrorModel
|
||||
@{
|
||||
ViewData["Title"] = "Error";
|
||||
}
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (Model.ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Diagnostics;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace MTG_CollectionVerwaltung.Pages
|
||||
{
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
[IgnoreAntiforgeryToken]
|
||||
public class ErrorModel : PageModel
|
||||
{
|
||||
public string? RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
|
||||
private readonly ILogger<ErrorModel> _logger;
|
||||
|
||||
public ErrorModel(ILogger<ErrorModel> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
@page
|
||||
@model IndexModel
|
||||
@{
|
||||
ViewData["Title"] = "Home page";
|
||||
}
|
||||
|
||||
@* <div class="text-center">
|
||||
<h1 class="display-4">Welcome</h1>
|
||||
<p>Learn about <a href="https://learn.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
|
||||
</div> *@
|
||||
|
||||
<div class="btn-group" role="group">
|
||||
<input type="radio" class="btn-check" name="btnradio" id="btnradioDecks" value="decks" autocomplete="off" checked>
|
||||
<label class="btn btn-outline-secondary" for="btnradioDecks">Decks</label>
|
||||
|
||||
<input type="radio" class="btn-check" name="btnradio" id="btnradioCards" value="cards" autocomplete="off">
|
||||
<label class="btn btn-outline-secondary" for="btnradioCards">Karten</label>
|
||||
|
||||
</div>
|
||||
<form id="searchForm" method="post">
|
||||
<div class="input-group">
|
||||
<input type="text" id="searchInput" name="searchInput" class="form-control" placeholder="">
|
||||
<button class="btn btn-outline-secondary" type="submit" id="button_search"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
const searchInput = document.getElementById("searchInput");
|
||||
const searchForm = document.getElementById("searchForm");
|
||||
const radios = document.querySelectorAll("input[name='btnradio']");
|
||||
|
||||
radios.forEach(radio => {
|
||||
radio.addEventListener("change", () => {
|
||||
if (radio.value === "decks") {
|
||||
searchInput.placeholder = "Nach Decks suchen...";
|
||||
searchForm.action = "/Index?handler=Decks";
|
||||
} else if (radio.value === "cards") {
|
||||
searchInput.placeholder = "Nach Karten suchen...";
|
||||
searchForm.action = "/Index?handler=Cards";
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Initial setzen
|
||||
document.querySelector("input[name='btnradio']:checked").dispatchEvent(new Event("change"));
|
||||
</script>
|
||||
@@ -0,0 +1,44 @@
|
||||
using Humanizer;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
//using Microsoft.EntityFrameworkCore;
|
||||
using MTG_CollectionVerwaltung.Data.MTGCollection;
|
||||
using MTG_CollectionVerwaltung.Helpers;
|
||||
//using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
|
||||
using static System.Net.WebRequestMethods;
|
||||
|
||||
namespace MTG_CollectionVerwaltung.Pages
|
||||
{
|
||||
public class IndexModel : PageModel
|
||||
{
|
||||
private readonly ILogger<IndexModel> _logger;
|
||||
|
||||
private readonly MTGContext _context;
|
||||
|
||||
public IndexModel(ILogger<IndexModel> logger, MTGContext mTGContext)
|
||||
{
|
||||
_logger = logger;
|
||||
_context = mTGContext;
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IActionResult OnPostDecks(string searchInput)
|
||||
{
|
||||
return Page();
|
||||
}
|
||||
|
||||
public IActionResult OnPostCards(string searchInput)
|
||||
{
|
||||
//var cards = CardSearcher.SearchCards(_context, searchInput);
|
||||
|
||||
return RedirectToPage("/Cards/Search", new { Searchquerry = searchInput });
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
@page
|
||||
@model PrivacyModel
|
||||
@{
|
||||
ViewData["Title"] = "Privacy Policy";
|
||||
}
|
||||
<h1>@ViewData["Title"]</h1>
|
||||
|
||||
<p>Use this page to detail your site's privacy policy.</p>
|
||||
@@ -0,0 +1,20 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace MTG_CollectionVerwaltung.Pages
|
||||
{
|
||||
public class PrivacyModel : PageModel
|
||||
{
|
||||
private readonly ILogger<PrivacyModel> _logger;
|
||||
|
||||
public PrivacyModel(ILogger<PrivacyModel> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@using MTG_CollectionVerwaltung.Data.MTGCollection
|
||||
@model CardPrinting
|
||||
|
||||
<a class="card-control" asp-page="/Cards/Details" asp-route-id="@Model.Id">
|
||||
<img src="@Model.ImageUriNormal" />
|
||||
<p>@Model.Name</p>
|
||||
</a>
|
||||
@@ -0,0 +1,53 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - MTG_CollectionVerwaltung</title>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/MTG_CollectionVerwaltung.styles.css" asp-append-version="true" />
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" asp-area="" asp-page="/Index">MTG_CollectionVerwaltung</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-page="/Index">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-page="/Privacy">Privacy</a>
|
||||
</li>
|
||||
</ul>
|
||||
<partial name="_LoginPartial" />
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="container">
|
||||
<main role="main" class="pb-3">
|
||||
@RenderBody()
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<footer class="border-top footer text-muted">
|
||||
<div class="container">
|
||||
© 2025 - MTG_CollectionVerwaltung - <a asp-area="" asp-page="/Privacy">Privacy</a>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
|
||||
@await RenderSectionAsync("Scripts", required: false)
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,48 @@
|
||||
/* Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
||||
for details on configuring this project to bundle and minify static web assets. */
|
||||
|
||||
a.navbar-brand {
|
||||
white-space: normal;
|
||||
text-align: center;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0077cc;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
.border-top {
|
||||
border-top: 1px solid #e5e5e5;
|
||||
}
|
||||
.border-bottom {
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
}
|
||||
|
||||
.box-shadow {
|
||||
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
|
||||
}
|
||||
|
||||
button.accept-policy {
|
||||
font-size: 1rem;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
line-height: 60px;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
@inject SignInManager<ApplicationUser> SignInManager
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
|
||||
<ul class="navbar-nav">
|
||||
@if (SignInManager.IsSignedIn(User))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello @User.Identity?.Name!</a>
|
||||
</li>
|
||||
@if (User.IsInRole("Admin"))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Admin/Index" title="AdminManage">Admin</a>
|
||||
</li>
|
||||
}
|
||||
<li class="nav-item">
|
||||
<form class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Page("/Index", new { area = "" })">
|
||||
<button type="submit" class="nav-link btn btn-link text-dark">Logout</button>
|
||||
</form>
|
||||
</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Register">Register</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Login">Login</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
@@ -0,0 +1,2 @@
|
||||
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
||||
@@ -0,0 +1,5 @@
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
@using MTG_CollectionVerwaltung
|
||||
@using MTG_CollectionVerwaltung.Data
|
||||
@namespace MTG_CollectionVerwaltung.Pages
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@@ -0,0 +1,3 @@
|
||||
@{
|
||||
Layout = "_Layout";
|
||||
}
|
||||
Reference in New Issue
Block a user