From 90a9857425950d8295881ba0dc71c61744a172dc Mon Sep 17 00:00:00 2001 From: EkaterinaR Date: Mon, 4 Nov 2024 20:28:47 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BD=D0=B0=D1=87=D0=B0=D0=BB=D0=BE=20=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20=D1=81=20=D1=81=D1=81=D1=8B?= =?UTF-8?q?=D0=BB=D0=BA=D0=BE=D0=B9=20=D1=80=D0=B5=D0=B3=D0=B8=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/HomeController.cs | 17 +++++- .../Views/Home/RegistrationOnEvent.cshtml | 54 +++++++++++++++++++ .../Views/Home/RegistrationOnEvent.cshtml.cs | 12 +++++ .../Views/Home/ViewEvent.cshtml | 4 +- .../Entities/EventEntity.cs | 11 ++-- ... 20241104161237_InitialCreate.Designer.cs} | 6 ++- ...ate.cs => 20241104161237_InitialCreate.cs} | 3 +- .../EventVisitorDbContextModelSnapshot.cs | 4 ++ .../BindingModels/EventBindingModel.cs | 1 + .../ViewModels/EventViewModel.cs | 1 + .../EventVisitorModels/IEventModel.cs | 1 + 11 files changed, 105 insertions(+), 9 deletions(-) create mode 100644 EventVisitor/EventVisitorClientApp/Views/Home/RegistrationOnEvent.cshtml create mode 100644 EventVisitor/EventVisitorClientApp/Views/Home/RegistrationOnEvent.cshtml.cs rename EventVisitor/EventVisitorDatabase/Migrations/{20241104114850_InitialCreate.Designer.cs => 20241104161237_InitialCreate.Designer.cs} (97%) rename EventVisitor/EventVisitorDatabase/Migrations/{20241104114850_InitialCreate.cs => 20241104161237_InitialCreate.cs} (98%) diff --git a/EventVisitor/EventVisitorClientApp/Controllers/HomeController.cs b/EventVisitor/EventVisitorClientApp/Controllers/HomeController.cs index e03098e..405d5f2 100644 --- a/EventVisitor/EventVisitorClientApp/Controllers/HomeController.cs +++ b/EventVisitor/EventVisitorClientApp/Controllers/HomeController.cs @@ -10,6 +10,7 @@ using System.Net; using System.Numerics; using System.Security.Cryptography.Xml; using System.Xml.Linq; +using Microsoft.Extensions.Logging; namespace EventVisitorClientApp.Controllers { @@ -206,7 +207,8 @@ namespace EventVisitorClientApp.Controllers Date = DateTime.Now.ToUniversalTime(), CountVisitors = count, FreePlaces = count, - OrganizerId = APIClient.Client.Id + OrganizerId = APIClient.Client.Id, + Link = "" }); Response.Redirect("MyEvents"); } @@ -237,6 +239,18 @@ namespace EventVisitorClientApp.Controllers return View(eventDetails); } + //public IActionResult GenerateLink(EventViewModel model, int id) + //{ + // if (APIClient.Client == null) + // { + // return Redirect("~/Home/Enter"); + // } + // var eventDetails = APIClient.GetRequest($"api/main/GetEvent?EventId={id}"); + // var registrationLink = Url.Action("Register", "Events", eventid = id, Request.Scheme); + + // return View(eventDetails); + //} + [HttpPost] public void UpdateEvent(int id, string name, string description, string type, string phone, string email, string address, string city, string status, int count, DateTime timestart, DateTime timeend) { @@ -259,7 +273,6 @@ namespace EventVisitorClientApp.Controllers TimeStart = timestart.ToUniversalTime(), Date = DateTime.Now.ToUniversalTime(), CountVisitors = count, - FreePlaces = count, OrganizerId = APIClient.Client.Id }); Response.Redirect("MyEvents"); diff --git a/EventVisitor/EventVisitorClientApp/Views/Home/RegistrationOnEvent.cshtml b/EventVisitor/EventVisitorClientApp/Views/Home/RegistrationOnEvent.cshtml new file mode 100644 index 0000000..e99e97f --- /dev/null +++ b/EventVisitor/EventVisitorClientApp/Views/Home/RegistrationOnEvent.cshtml @@ -0,0 +1,54 @@ +@{ + ViewData["Title"] = "RegistrationOnEvent"; +} + +
+

Регистрация на мероприятие

+ +
+
+ + +
Пожалуйста, введите имя.
+
+ +
+ + +
Пожалуйста, введите номер телефона.
+
+ +
+ + +
Пожалуйста, введите e-mail.
+
+ +
+ + +
Пожалуйста, введите дату рождения.
+
+ +
+ +
+
+
+ + + + + + + + + diff --git a/EventVisitor/EventVisitorClientApp/Views/Home/RegistrationOnEvent.cshtml.cs b/EventVisitor/EventVisitorClientApp/Views/Home/RegistrationOnEvent.cshtml.cs new file mode 100644 index 0000000..859f522 --- /dev/null +++ b/EventVisitor/EventVisitorClientApp/Views/Home/RegistrationOnEvent.cshtml.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace EventVisitorClientApp.Views.Home +{ + public class RegistrationOnEventModel : PageModel + { + public void OnGet() + { + } + } +} diff --git a/EventVisitor/EventVisitorClientApp/Views/Home/ViewEvent.cshtml b/EventVisitor/EventVisitorClientApp/Views/Home/ViewEvent.cshtml index c5a6d47..0e3b9d9 100644 --- a/EventVisitor/EventVisitorClientApp/Views/Home/ViewEvent.cshtml +++ b/EventVisitor/EventVisitorClientApp/Views/Home/ViewEvent.cshtml @@ -51,8 +51,8 @@ - - + + diff --git a/EventVisitor/EventVisitorDatabase/Entities/EventEntity.cs b/EventVisitor/EventVisitorDatabase/Entities/EventEntity.cs index 7b1ac98..d3a1c08 100644 --- a/EventVisitor/EventVisitorDatabase/Entities/EventEntity.cs +++ b/EventVisitor/EventVisitorDatabase/Entities/EventEntity.cs @@ -45,6 +45,8 @@ namespace EventVisitorDatabase.Entities [Required] public int OrganizerId { get; set; } + public string Link { get; set; } = string.Empty; + public static EventEntity? Create(EventBindingModel model) { @@ -68,7 +70,8 @@ namespace EventVisitorDatabase.Entities Status = model.Status, CountVisitors = model.CountVisitors, FreePlaces = model.FreePlaces, - OrganizerId = model.OrganizerId + OrganizerId = model.OrganizerId, + Link = model.Link }; } @@ -90,7 +93,8 @@ namespace EventVisitorDatabase.Entities Status = model.Status, CountVisitors = model.CountVisitors, FreePlaces = model.FreePlaces, - OrganizerId = model.OrganizerId + OrganizerId = model.OrganizerId, + Link = model.Link }; } @@ -127,7 +131,8 @@ namespace EventVisitorDatabase.Entities Status = Status, CountVisitors = CountVisitors, FreePlaces = FreePlaces, - OrganizerId = OrganizerId + OrganizerId = OrganizerId, + Link = Link }; } } diff --git a/EventVisitor/EventVisitorDatabase/Migrations/20241104114850_InitialCreate.Designer.cs b/EventVisitor/EventVisitorDatabase/Migrations/20241104161237_InitialCreate.Designer.cs similarity index 97% rename from EventVisitor/EventVisitorDatabase/Migrations/20241104114850_InitialCreate.Designer.cs rename to EventVisitor/EventVisitorDatabase/Migrations/20241104161237_InitialCreate.Designer.cs index 35c396c..94b51f0 100644 --- a/EventVisitor/EventVisitorDatabase/Migrations/20241104114850_InitialCreate.Designer.cs +++ b/EventVisitor/EventVisitorDatabase/Migrations/20241104161237_InitialCreate.Designer.cs @@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace EventVisitorDatabase.Migrations { [DbContext(typeof(EventVisitorDbContext))] - [Migration("20241104114850_InitialCreate")] + [Migration("20241104161237_InitialCreate")] partial class InitialCreate { /// @@ -62,6 +62,10 @@ namespace EventVisitorDatabase.Migrations b.Property("FreePlaces") .HasColumnType("integer"); + b.Property("Link") + .IsRequired() + .HasColumnType("text"); + b.Property("Name") .IsRequired() .HasColumnType("text"); diff --git a/EventVisitor/EventVisitorDatabase/Migrations/20241104114850_InitialCreate.cs b/EventVisitor/EventVisitorDatabase/Migrations/20241104161237_InitialCreate.cs similarity index 98% rename from EventVisitor/EventVisitorDatabase/Migrations/20241104114850_InitialCreate.cs rename to EventVisitor/EventVisitorDatabase/Migrations/20241104161237_InitialCreate.cs index 70acd67..893f161 100644 --- a/EventVisitor/EventVisitorDatabase/Migrations/20241104114850_InitialCreate.cs +++ b/EventVisitor/EventVisitorDatabase/Migrations/20241104161237_InitialCreate.cs @@ -31,7 +31,8 @@ namespace EventVisitorDatabase.Migrations Status = table.Column(type: "text", nullable: false), CountVisitors = table.Column(type: "integer", nullable: false), FreePlaces = table.Column(type: "integer", nullable: false), - OrganizerId = table.Column(type: "integer", nullable: false) + OrganizerId = table.Column(type: "integer", nullable: false), + Link = table.Column(type: "text", nullable: false) }, constraints: table => { diff --git a/EventVisitor/EventVisitorDatabase/Migrations/EventVisitorDbContextModelSnapshot.cs b/EventVisitor/EventVisitorDatabase/Migrations/EventVisitorDbContextModelSnapshot.cs index 8c70b97..f3a22a4 100644 --- a/EventVisitor/EventVisitorDatabase/Migrations/EventVisitorDbContextModelSnapshot.cs +++ b/EventVisitor/EventVisitorDatabase/Migrations/EventVisitorDbContextModelSnapshot.cs @@ -59,6 +59,10 @@ namespace EventVisitorDatabase.Migrations b.Property("FreePlaces") .HasColumnType("integer"); + b.Property("Link") + .IsRequired() + .HasColumnType("text"); + b.Property("Name") .IsRequired() .HasColumnType("text"); diff --git a/EventVisitor/EventVisitorLogic/BindingModels/EventBindingModel.cs b/EventVisitor/EventVisitorLogic/BindingModels/EventBindingModel.cs index 6c00275..243663c 100644 --- a/EventVisitor/EventVisitorLogic/BindingModels/EventBindingModel.cs +++ b/EventVisitor/EventVisitorLogic/BindingModels/EventBindingModel.cs @@ -25,5 +25,6 @@ namespace EventVisitorLogic.BindingModels public int CountVisitors { get; set; } public int FreePlaces { get; set; } public int OrganizerId { get; set; } + public string Link { get; set; } = string.Empty; } } diff --git a/EventVisitor/EventVisitorLogic/ViewModels/EventViewModel.cs b/EventVisitor/EventVisitorLogic/ViewModels/EventViewModel.cs index c3b3704..d1f911c 100644 --- a/EventVisitor/EventVisitorLogic/ViewModels/EventViewModel.cs +++ b/EventVisitor/EventVisitorLogic/ViewModels/EventViewModel.cs @@ -24,5 +24,6 @@ namespace EventVisitorLogic.ViewModels public int CountVisitors { get; set; } public int FreePlaces { get; set; } public int OrganizerId { get; set; } + public string Link { get; set; } = string.Empty; } } diff --git a/EventVisitor/EventVisitorModels/IEventModel.cs b/EventVisitor/EventVisitorModels/IEventModel.cs index 772b1a6..03cc9e4 100644 --- a/EventVisitor/EventVisitorModels/IEventModel.cs +++ b/EventVisitor/EventVisitorModels/IEventModel.cs @@ -23,6 +23,7 @@ namespace EventVisitorModels public int CountVisitors { get; set; } public int FreePlaces { get; set; } public int OrganizerId { get; set; } + public string Link { get; set; } = string.Empty; } }