начало работы с ссылкой регистрации

This commit is contained in:
EkaterinaR 2024-11-04 20:28:47 +04:00
parent b2f1e1c322
commit 90a9857425
11 changed files with 105 additions and 9 deletions

View File

@ -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<EventViewModel>($"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");

View File

@ -0,0 +1,54 @@
@{
ViewData["Title"] = "RegistrationOnEvent";
}
<div class="containerenter text-center mt-5">
<h2 class="display-4 mb-4">Регистрация на мероприятие</h2>
<form method="post" class="border p-4 rounded">
<div class="mb-4">
<label for="InputName" class="form-label" style="font-size: 24px" ;>Введите имя</label>
<input type="text" name="name" class="form-control" id="name" required>
<div class="invalid-feedback">Пожалуйста, введите имя.</div>
</div>
<div class="mb-4">
<label for="InputPhone" class="form-label" style="font-size: 24px">Введите телефон</label>
<input type="text" name="phone" class="form-control" id="phone" required>
<div class="invalid-feedback">Пожалуйста, введите номер телефона.</div>
</div>
<div class="mb-4">
<label for="InputEmail" class="form-label" style="font-size: 24px">Введите e-mail</label>
<input type="text" name="email" class="form-control" id="email" required>
<div class="invalid-feedback">Пожалуйста, введите e-mail.</div>
</div>
<div class="mb-4">
<label for="InputI" class="form-label" style="font-size: 24px">Введите дату рождения</label>
<input type="datetime-local" class="form-control" id="dayBirth" name="dayBirth" required>
<div class="invalid-feedback">Пожалуйста, введите дату рождения.</div>
</div>
<div class="mb-4">
<button type="submit" class="btn btn-dark btn-lg w-100">Зарегистрироваться</button>
</div>
</form>
</div>
<style>
.containerenter {
max-width: 500px;
margin: auto;
background-color: #f8f9fa;
border-radius: 10px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
</style>

View File

@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace EventVisitorClientApp.Views.Home
{
public class RegistrationOnEventModel : PageModel
{
public void OnGet()
{
}
}
}

View File

@ -51,8 +51,8 @@
</form>
</div>
</div>
<button type="submit" class="btn btn-black btn-block mb-4">Отправить</button>
<button type="submit" class="btn btn-black btn-block">Отправить</button>
<button type="submit" class="btn btn-black btn-block mb-4" asp-action="GenerateLink" asp-route-id="@Html.DisplayFor(model => model.Id)">Сгенерировать ссылку для регистрации</button>
<button type="submit" class="btn btn-black btn-block">Зарегистрованные пользователи</button>
</div>
</div>
</div>

View File

@ -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
};
}
}

View File

@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace EventVisitorDatabase.Migrations
{
[DbContext(typeof(EventVisitorDbContext))]
[Migration("20241104114850_InitialCreate")]
[Migration("20241104161237_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
@ -62,6 +62,10 @@ namespace EventVisitorDatabase.Migrations
b.Property<int>("FreePlaces")
.HasColumnType("integer");
b.Property<string>("Link")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");

View File

@ -31,7 +31,8 @@ namespace EventVisitorDatabase.Migrations
Status = table.Column<string>(type: "text", nullable: false),
CountVisitors = table.Column<int>(type: "integer", nullable: false),
FreePlaces = table.Column<int>(type: "integer", nullable: false),
OrganizerId = table.Column<int>(type: "integer", nullable: false)
OrganizerId = table.Column<int>(type: "integer", nullable: false),
Link = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{

View File

@ -59,6 +59,10 @@ namespace EventVisitorDatabase.Migrations
b.Property<int>("FreePlaces")
.HasColumnType("integer");
b.Property<string>("Link")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}