From 3826d39557c905f9a0f4cb8651e12cad99b7db73 Mon Sep 17 00:00:00 2001 From: Laci <mlacko020523@gmail.com> Date: Wed, 28 Feb 2024 20:24:36 +0100 Subject: [PATCH] =?UTF-8?q?M=C3=A1sodik=20alkalom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Rendelosch/Models/ProductForm.cs | 11 +++++++++-- Rendelosch/Pages/SubmitForm.cshtml | 27 +++++++++++++++++++++++++++ Rendelosch/Pages/SubmitForm.cshtml.cs | 19 +++++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 Rendelosch/Pages/SubmitForm.cshtml create mode 100644 Rendelosch/Pages/SubmitForm.cshtml.cs diff --git a/Rendelosch/Models/ProductForm.cs b/Rendelosch/Models/ProductForm.cs index e97fe59..97fb449 100644 --- a/Rendelosch/Models/ProductForm.cs +++ b/Rendelosch/Models/ProductForm.cs @@ -1,6 +1,8 @@ -namespace Rendelosch.Models; +using System.Collections; -public class ProductForm +namespace Rendelosch.Models; + +public class ProductForm : IEnumerable { public readonly string Id; public readonly string Title; @@ -15,4 +17,9 @@ public class ProductForm Title = title; Fields = fields; } + + public IEnumerator GetEnumerator() + { + throw new NotImplementedException(); + } } \ No newline at end of file diff --git a/Rendelosch/Pages/SubmitForm.cshtml b/Rendelosch/Pages/SubmitForm.cshtml new file mode 100644 index 0000000..597f221 --- /dev/null +++ b/Rendelosch/Pages/SubmitForm.cshtml @@ -0,0 +1,27 @@ +@page "{Id}" +@model Rendelosch.Pages.SubmitForm + +@{ + ViewData["Title"] = "Submit"; +} + +<form method="post" > + <div class="container-lg"> + <h1>@Model.Repository.GetProductForm(Request.RouteValues["Id"].ToString()).Title</h1> + <div> + @foreach (var productForm in Model.Repository.GetProductForm(Request.RouteValues["Id"].ToString()).Fields) + { + <div class="card-title col-6 m-0 me-3"> + <Label > + @productForm.Name + </Label> + <input class="form-control col-6"/> + </div> + + } + <input class="btn btn-primary mt-4" type="submit"/> + </div> + </div> +</form> + + diff --git a/Rendelosch/Pages/SubmitForm.cshtml.cs b/Rendelosch/Pages/SubmitForm.cshtml.cs new file mode 100644 index 0000000..3abfe63 --- /dev/null +++ b/Rendelosch/Pages/SubmitForm.cshtml.cs @@ -0,0 +1,19 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; +using Rendelosch.Repository; + +namespace Rendelosch.Pages; + +public class SubmitForm : PageModel +{ + public IProductFormRepository Repository { get; } + + public SubmitForm(IProductFormRepository repository) + { + Repository = repository; + } + + public void OnPost() + { + + } +} \ No newline at end of file -- GitLab