Přemístění + dodělání funkčnosti webu.

This commit is contained in:
Matěj Kubíček
2026-09-17 17:50:48 +02:00
parent 3a35d10227
commit f223721fbd
128 changed files with 714 additions and 172 deletions
@@ -1,34 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using StuzkovakWeb.Data;
using StuzkovakWeb.ViewModels;
namespace StuzkovakWeb.Areas.Admin.Controllers;
public class InvitesController : AdminBaseController
{
private readonly AppDbContext _context;
public InvitesController(AppDbContext context)
{
_context = context;
}
public async Task<IActionResult> Index()
{
var invites = await _context.Invites.ToListAsync();
return View(invites);
}
public async Task<IActionResult> Details(Guid id)
{
var invite = await _context.Invites.FirstOrDefaultAsync(i => i.Id == id);
if (invite == null) return NotFound();
return View(new AdminInviteDetailViewModel
{
Id = invite.Id,
TeacherName = invite.TeacherName,
IsAccepted = invite.IsAccepted
});
}
}
@@ -1,19 +0,0 @@
@{
ViewData["Title"] = "Dashboard";
}
<h1>Admin Dashboard</h1>
<p>Welcome to the administration area.</p>
<div class="row mt-4">
<div class="col-md-4">
<div class="card text-white bg-primary mb-3">
<div class="card-header">Users</div>
<div class="card-body">
<h5 class="card-title">Manage system users</h5>
<p class="card-text">View and edit user details.</p>
<a asp-controller="Users" asp-action="Index" class="btn btn-light">Go to Users</a>
</div>
</div>
</div>
</div>
@@ -1,41 +0,0 @@
@model List<StuzkovakWeb.Entities.InviteEntity>
@{
ViewData["Title"] = "Invite Management";
}
<div class="d-flex justify-content-between align-items-center mb-4">
<h1>Pozvánky</h1>
</div>
<table class="table table-striped table-hover">
<thead class="table-dark">
<tr>
<th>ID</th>
<th>Učitel</th>
<th>Potvrzení</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach (var invite in Model)
{
<tr>
<td>@invite.Id</td>
<td>@invite.TeacherName</td>
<td>@{
if (invite.IsAccepted == true)
{
<span class="badge bg-success">Ano</span>
}
else if (invite.IsAccepted == false)
{
<span class="badge bg-danger">Ne</span>
}
}</td>
<td>
<a asp-action="Details" asp-route-id="@invite.Id" class="btn btn-sm btn-outline-primary">Details</a>
</td>
</tr>
}
</tbody>
</table>
@@ -1,8 +0,0 @@
@{
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>
@@ -1,6 +0,0 @@
@{
ViewData["Title"] = "Privacy Policy";
}
<h1>@ViewData["Title"]</h1>
<p>Use this page to detail your site's privacy policy.</p>
-58
View File
@@ -1,58 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT="$SCRIPT_DIR/Template"
if [[ ! -d "$ROOT" ]]; then
echo "Error: Template directory not found at $ROOT"
exit 1
fi
echo "========================================="
echo " MVC Template - Project Rename Tool"
echo "========================================="
echo ""
read -rp "Enter new project name: " NEW_NAME
if [[ -z "$NEW_NAME" ]]; then
echo "Error: Project name cannot be empty."
exit 1
fi
echo ""
echo "Renaming 'Template' -> '$NEW_NAME'..."
echo ""
# Rename files first (deepest first to avoid path issues)
while IFS= read -r -d '' path; do
dir="$(dirname "$path")"
base="$(basename "$path")"
new_base="${base//Template/$NEW_NAME}"
if [[ "$base" != "$new_base" ]]; then
echo " FILE: $base -> $new_base"
mv "$path" "$dir/$new_base"
fi
done < <(find "$ROOT" \
-not -path "*/bin/*" \
-not -path "*/obj/*" \
-not -path "*/.idea/*" \
-type f -name "*Template*" -print0 | sort -rz)
# Rename directories (deepest first)
while IFS= read -r -d '' path; do
parent="$(dirname "$path")"
base="$(basename "$path")"
new_base="${base//Template/$NEW_NAME}"
if [[ "$base" != "$new_base" ]]; then
echo " DIR: $base -> $new_base"
mv "$path" "$parent/$new_base"
fi
done < <(find "$ROOT" \
-not -path "*/bin/*" \
-not -path "*/obj/*" \
-not -path "*/.idea/*" \
-type d -name "*Template*" -print0 | sort -rz)
echo ""
echo "Done! Project renamed to '$NEW_NAME'."
+15
View File
@@ -0,0 +1,15 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Rider ignored files
/modules.xml
/contentModel.xml
/projectSettingsUpdater.xml
/.idea.Stuzkovak.iml
# Ignored default folder with query files
/queries/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
+1
View File
@@ -0,0 +1 @@
Stuzkovak
+13
View File
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="templatedb@localhost" uuid="82e974cc-5988-4c16-8871-15de47bac94f">
<driver-ref>postgresql</driver-ref>
<synchronize>true</synchronize>
<configured-by-url>true</configured-by-url>
<jdbc-driver>org.postgresql.Driver</jdbc-driver>
<jdbc-url>jdbc:postgresql://localhost/templatedb?password=password&amp;user=user</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
</component>
</project>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>
@@ -0,0 +1,77 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using StuzkovakWeb.Data;
using StuzkovakWeb.Entities;
using StuzkovakWeb.ViewModels;
namespace StuzkovakWeb.Areas.Admin.Controllers;
public class InvitesController : AdminBaseController
{
private readonly AppDbContext _context;
public InvitesController(AppDbContext context)
{
_context = context;
}
public async Task<IActionResult> Index()
{
var invites = await _context.Invites.ToListAsync();
return View(invites);
}
public async Task<IActionResult> Details(Guid id)
{
var invite = await _context.Invites.FirstOrDefaultAsync(i => i.Id == id);
if (invite == null) return NotFound();
return View(new AdminInviteDetailViewModel
{
Id = invite.Id,
TeacherName = invite.TeacherName,
IsAccepted = invite.IsAccepted
});
}
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create(string teacherName)
{
if (string.IsNullOrEmpty(teacherName)) return BadRequest();
var invite = new InviteEntity
{
TeacherName = teacherName,
IsAccepted = null
};
await _context.Invites.AddAsync(invite);
await _context.SaveChangesAsync();
TempData["SuccessMessage"] = "Pozvánka byla vytvořena.";
return RedirectToAction("Index");
}
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Delete(Guid id)
{
var invite = await _context.Invites.FirstOrDefaultAsync(i => i.Id == id);
if (invite == null) return NotFound();
_context.Invites.Remove(invite);
await _context.SaveChangesAsync();
return RedirectToAction("Index");
}
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Edit(Guid id, string name)
{
var invite = await _context.Invites.FirstOrDefaultAsync(i => i.Id == id);
if (invite is null) return NotFound();
invite.TeacherName = name;
await _context.SaveChangesAsync();
TempData["SuccessMessage"] = "Pozvánka byla upravena.";
return RedirectToAction("Details", new { id });
}
}
@@ -0,0 +1,27 @@
@{
ViewData["Title"] = "Dashboard";
}
<h1>Admin Dashboard</h1>
<p>Vítejte v administraci.</p>
<div class="row mt-4">
<div class="col-md-4">
<div class="card text-white bg-primary mb-3">
<div class="card-header">Pozvánky</div>
<div class="card-body">
<h5 class="card-title">Správa pozvánek</h5>
<p class="card-text">Přidání, mazání a úprava pozvánek pro učitele.</p>
<a asp-controller="Invites" asp-action="Index" class="btn btn-light">Jít k pozvánkám</a>
</div>
</div>
<div class="card text-white bg-secondary mb-3">
<div class="card-header">Uživatelé</div>
<div class="card-body">
<h5 class="card-title">Správa uživatelů</h5>
<p class="card-text">Zobrazení a úprava uživatelů.</p>
<a asp-controller="Users" asp-action="Index" class="btn btn-light">Jít k uživatelům</a>
</div>
</div>
</div>
</div>
@@ -38,3 +38,26 @@
</dl> </dl>
</div> </div>
</div> </div>
<div class="card mb-4">
<div class="card-header">
<h5 class="mb-0">Upravit jméno učitele</h5>
</div>
<div class="card-body">
<form asp-action="Edit" method="post">
@Html.AntiForgeryToken()
<input type="hidden" name="id" value="@Model.Id" />
<div class="mb-3">
<label for="name" class="form-label">Jméno učitele</label>
<input type="text" class="form-control" id="name" name="name" value="@Model.TeacherName" required />
</div>
<button type="submit" class="btn btn-primary">Uložit</button>
</form>
</div>
</div>
<form asp-action="Delete" asp-route-id="@Model.Id" method="post"
onsubmit="return confirm('Opravdu smazat tuto pozvánku?');">
@Html.AntiForgeryToken()
<button type="submit" class="btn btn-danger">Smazat pozvánku</button>
</form>
@@ -0,0 +1,84 @@
@model List<StuzkovakWeb.Entities.InviteEntity>
@{
ViewData["Title"] = "Invite Management";
}
<div class="d-flex justify-content-between align-items-center mb-4">
<h1>Pozvánky</h1>
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#createInviteModal">
+ Nová pozvánka
</button>
</div>
@if (TempData["SuccessMessage"] != null)
{
<div class="alert alert-success">@TempData["SuccessMessage"]</div>
}
<table class="table table-striped table-hover">
<thead class="table-dark">
<tr>
<th>ID</th>
<th>Učitel</th>
<th>Potvrzení</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach (var invite in Model)
{
<tr>
<td>@invite.Id</td>
<td>@invite.TeacherName</td>
<td>@{
if (invite.IsAccepted == true)
{
<span class="badge bg-success">Ano</span>
}
else if (invite.IsAccepted == false)
{
<span class="badge bg-danger">Ne</span>
}
}</td>
<td class="d-flex gap-1">
<a asp-action="Details" asp-route-id="@invite.Id" class="btn btn-sm btn-outline-primary">Details</a>
<form asp-action="Delete" asp-route-id="@invite.Id" method="post"
onsubmit="return confirm('Opravdu smazat tuto pozvánku?');">
@Html.AntiForgeryToken()
<button type="submit" class="btn btn-sm btn-outline-danger">Smazat</button>
</form>
<a
asp-area="" asp-controller="Home" asp-action="Index" asp-route-id="@invite.Id"
class="btn btn-sm btn-outline-secondary">
Ukázka
</a>
</td>
</tr>
}
</tbody>
</table>
<!-- Create Invite Modal -->
<div class="modal fade" id="createInviteModal" tabindex="-1" aria-labelledby="createInviteModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<form asp-action="Create" method="post">
@Html.AntiForgeryToken()
<div class="modal-header">
<h5 class="modal-title" id="createInviteModalLabel">Nová pozvánka</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label for="teacherName" class="form-label">Jméno učitele</label>
<input type="text" class="form-control" id="teacherName" name="teacherName" required autofocus />
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Zrušit</button>
<button type="submit" class="btn btn-primary">Vytvořit</button>
</div>
</form>
</div>
</div>
</div>
@@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="cs">
<head> <head>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
@@ -48,9 +48,11 @@
<a asp-area="Admin" asp-controller="Dashboard" asp-action="Index">Dashboard</a> <a asp-area="Admin" asp-controller="Dashboard" asp-action="Index">Dashboard</a>
</li> </li>
<li class="@(ViewContext.RouteData.Values["controller"]?.ToString() == "Users" ? "active" : "")"> <li class="@(ViewContext.RouteData.Values["controller"]?.ToString() == "Users" ? "active" : "")">
<a asp-area="Admin" asp-controller="Users" asp-action="Index">Users</a> <a asp-area="Admin" asp-controller="Users" asp-action="Index">Uživatelé</a>
</li>
<li class="@(ViewContext.RouteData.Values["controller"]?.ToString() == "Invites" ? "active" : "")">
<a asp-area="Admin" asp-controller="Invites" asp-action="Index">Pozvánky</a>
</li> </li>
<!-- Add more models here easily -->
</ul> </ul>
</nav> </nav>
@@ -1,14 +1,27 @@
using System.Diagnostics; using System.Diagnostics;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using StuzkovakWeb.Data;
using StuzkovakWeb.Models; using StuzkovakWeb.Models;
namespace StuzkovakWeb.Controllers; namespace StuzkovakWeb.Controllers;
public class HomeController : Controller public class HomeController : Controller
{ {
public IActionResult Index() private readonly AppDbContext _context;
public HomeController(AppDbContext context)
{ {
return View(); _context = context;
}
public IActionResult Index(Guid? id)
{
if (id == null) return View();
var invite = _context.Invites.FirstOrDefault(i => i.Id == id);
if (invite == null) return NotFound();
return View(invite);
} }
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
@@ -0,0 +1,44 @@
using Microsoft.AspNetCore.Mvc;
using StuzkovakWeb.Data;
namespace StuzkovakWeb.Controllers;
public class InvitesController : Controller
{
private readonly AppDbContext _context;
public InvitesController(AppDbContext context)
{
_context = context;
}
public async Task<IActionResult> Accept(Guid id)
{
var invite = await _context.Invites.FindAsync(id);
if (invite == null)
{
return NotFound();
}
invite.IsAccepted = true;
_context.Invites.Update(invite);
await _context.SaveChangesAsync();
return RedirectToAction("Index", "Home", new { Id=id });
}
public async Task<IActionResult> Refuse(Guid id)
{
var invite = await _context.Invites.FindAsync(id);
if (invite == null)
{
return NotFound();
}
invite.IsAccepted = false;
_context.Invites.Update(invite);
await _context.SaveChangesAsync();
return RedirectToAction("Index", "Home", new { Id=id });
}
}
@@ -0,0 +1,295 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using StuzkovakWeb.Data;
#nullable disable
namespace StuzkovakWeb.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20260917152052_Invites")]
partial class Invites
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("text");
b.Property<string>("ClaimValue")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("ProviderKey")
.HasColumnType("text");
b.Property<string>("ProviderDisplayName")
.HasColumnType("text");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("RoleId")
.HasColumnType("text");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("text");
b.Property<string>("LoginProvider")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Value")
.HasColumnType("text");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("StuzkovakWeb.Entities.InviteEntity", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<bool?>("IsAccepted")
.HasColumnType("boolean");
b.Property<string>("TeacherName")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Invites");
});
modelBuilder.Entity("StuzkovakWeb.Entities.UserEntity", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<int>("AccessFailedCount")
.HasColumnType("integer");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("text");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("boolean");
b.Property<bool>("LockoutEnabled")
.HasColumnType("boolean");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("PasswordHash")
.HasColumnType("text");
b.Property<string>("PhoneNumber")
.HasColumnType("text");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property<string>("SecurityStamp")
.HasColumnType("text");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("StuzkovakWeb.Entities.UserEntity", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("StuzkovakWeb.Entities.UserEntity", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("StuzkovakWeb.Entities.UserEntity", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("StuzkovakWeb.Entities.UserEntity", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,35 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace StuzkovakWeb.Migrations
{
/// <inheritdoc />
public partial class Invites : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Invites",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
TeacherName = table.Column<string>(type: "text", nullable: false),
IsAccepted = table.Column<bool>(type: "boolean", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Invites", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Invites");
}
}
}
@@ -154,6 +154,24 @@ namespace StuzkovakWeb.Migrations
b.ToTable("AspNetUserTokens", (string)null); b.ToTable("AspNetUserTokens", (string)null);
}); });
modelBuilder.Entity("StuzkovakWeb.Entities.InviteEntity", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<bool?>("IsAccepted")
.HasColumnType("boolean");
b.Property<string>("TeacherName")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Invites");
});
modelBuilder.Entity("StuzkovakWeb.Entities.UserEntity", b => modelBuilder.Entity("StuzkovakWeb.Entities.UserEntity", b =>
{ {
b.Property<string>("Id") b.Property<string>("Id")
@@ -5,7 +5,7 @@
"commandName": "Project", "commandName": "Project",
"dotnetRunMessages": true, "dotnetRunMessages": true,
"launchBrowser": true, "launchBrowser": true,
"applicationUrl": "http://localhost:5240", "applicationUrl": "http://localhost:5300",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} }
+47
View File
@@ -0,0 +1,47 @@
@model StuzkovakWeb.Entities.InviteEntity?
@{
ViewData["Title"] = "Pozvánka";
}
@if (Model is not null)
{
<div>
<p>4.EP Vás zve na stužkovák!</p>
<p>Kde se bude konat? V UPu!</p>
<p>Kdy? 23. října!</p>
<p>pls zachraňte ten obsah někdo ;-;</p>
<p>Jméno učitele pro kontrolu: @Model.TeacherName</p>
@if (Model.IsAccepted is null)
{
<form asp-area="" asp-controller="Invites" asp-action="Accept">
<input type="text" asp-for="Id" hidden value="@Model.Id"></input>
<input type="submit" value="Přijmout pozvánku"></input>
</form>
<form asp-area="" asp-controller="Invites" asp-action="Refuse">
<input type="text" asp-for="Id" hidden value="@Model.Id"></input>
<input type="submit" value="Odmítnout pozvánku"></input>
</form>
}
else if (Model.IsAccepted == true)
{
<p>Děkujeme za příjetí pozvánky! Budeme se na Vás těšit.</p>
}
else if (Model.IsAccepted == false)
{
<p>Taková škoda... A my se na Vás tak těšili.</p>
}
</div>
}
else
{
<div class="text-center">
<h1 class="display-4">Stužkovák 4.EP</h1>
<p>Copak se stalo s Vaší pozvánkou? &#129300;</p>
</div>
}

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Some files were not shown because too many files have changed in this diff Show More