Skip to content
Snippets Groups Projects
Commit bf372610 authored by Gábor Tóth's avatar Gábor Tóth
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 376 additions and 0 deletions
bin/
obj/
/packages/
riderModule.iml
/_ReSharper.Caches/
**/.idea/**
**/.vscode/*
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rendelosch", "Rendelosch\Rendelosch.csproj", "{F95E2FEA-5998-4BF5-BEFF-69BBC943C107}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F95E2FEA-5998-4BF5-BEFF-69BBC943C107}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F95E2FEA-5998-4BF5-BEFF-69BBC943C107}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F95E2FEA-5998-4BF5-BEFF-69BBC943C107}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F95E2FEA-5998-4BF5-BEFF-69BBC943C107}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
namespace Rendelosch.Models;
public class Field
{
public readonly string Name;
public Field(string name)
{
Name = name;
}
}
\ No newline at end of file
namespace Rendelosch.Models;
public class ProductForm
{
public readonly string Id;
public readonly List<Field> Fields = new();
public ProductForm(string id, string title)
{
Id = id;
}
}
\ No newline at end of file
@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>
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Rendelosch.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;
}
}
@page
@model Rendelosch.Pages.FormEditor
<h2>Form Editor</h2>
\ No newline at end of file
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Rendelosch.Pages;
public class FormEditor : PageModel
{
public void OnGet()
{
}
}
\ No newline at end of file
@page
@model Rendelosch.Pages.Index
<div class="container-lg">
<h1 class="my-4">Hello, world!</h1>
<form method="post">
<button class="btn btn-primary mb-4">Create Product Form</button>
</form>
<div class="text">
<p>
<strong>The standard Lorem Ipsum passage, used since the 1500s</strong>
</p>
<p>
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
</p>
<p>
<strong>Section 1.10.33 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC</strong>
</p>
<p>
"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"
</p>
<p>
<strong>1914 translation by H. Rackham</strong>
</p>
<p>
"But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?"
</p>
</div>
</div>
\ No newline at end of file
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Rendelosch.Repository;
namespace Rendelosch.Pages;
public class Index : PageModel
{
private readonly IProductFormRepository _repository;
public Index(IProductFormRepository repository)
{
_repository = repository;
}
public void OnGet()
{
}
public void OnPost()
{
}
}
\ No newline at end of file
@page
@model PrivacyModel
@{
ViewData["Title"] = "Privacy Policy";
}
<h1>@ViewData["Title"]</h1>
<p>Use this page to detail your site's privacy policy.</p>
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Rendelosch.Pages;
public class PrivacyModel : PageModel
{
private readonly ILogger<PrivacyModel> _logger;
public PrivacyModel(ILogger<PrivacyModel> logger)
{
_logger = logger;
}
public void OnGet()
{
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>@ViewData["Title"]</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
</head>
<body>
<div class="container">
<div class="row">
<div class="column col-2">
<a asp-page="Index"><h4>Index</h4></a>
</div>
<div class="column col-2">
<a asp-page="Privacy"><h4>Privacy</h4></a>
</div>
</div>
</div>
@RenderBody()
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
</body>
</html>
\ No newline at end of file
@using Rendelosch
@namespace Rendelosch.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = "_Layout";
}
using Rendelosch.Repository;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddSingleton<IProductFormRepository>(new MemoryProductFormRepository());
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapRazorPages();
app.Run();
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:21066",
"sslPort": 44327
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "http://localhost:5081",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "https://localhost:7067;http://localhost:5081",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": false,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<_ContentIncludedByDefault Remove="wwwroot\css\site.css" />
</ItemGroup>
</Project>
namespace Rendelosch.Repository;
public interface IProductFormRepository
{
public string CreateProductForm(string formTitle);
public bool AddFieldToProductForm(string formId, string fieldName);
}
\ No newline at end of file
using Rendelosch.Models;
namespace Rendelosch.Repository;
public class MemoryProductFormRepository : IProductFormRepository
{
private List<ProductForm> _productForms = new();
public MemoryProductFormRepository()
{
var sampleForm1 = new ProductForm(Guid.NewGuid().ToString(), "DevTeam pulcsi");
sampleForm1.Fields.Add(new Field("Név"));
sampleForm1.Fields.Add(new Field("Email"));
sampleForm1.Fields.Add(new Field("Méret (XS/S/M/L/XL/XXL)"));
var sampleForm2 = new ProductForm(Guid.NewGuid().ToString(), "DevTeam kiskacsa");
sampleForm2.Fields.Add(new Field("Név"));
sampleForm2.Fields.Add(new Field("Email"));
sampleForm2.Fields.Add(new Field("Telefonszám"));
sampleForm2.Fields.Add(new Field("Szín (sárga/zöld/kék)"));
sampleForm2.Fields.Add(new Field("Megjegyzés"));
_productForms.Add(sampleForm1);
_productForms.Add(sampleForm2);
}
public string CreateProductForm(string formTitle)
{
var guid = Guid.NewGuid().ToString();
_productForms.Add(new ProductForm(guid, formTitle));
return guid;
}
public bool AddFieldToProductForm(string formId, string fieldName)
{
var form = _productForms.Find(f => f.Id == formId);
if (form == null) return false;
form.Fields.Add(new Field(fieldName));
return true;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment