работает список зарегистрированных пользователей

This commit is contained in:
EkaterinaR 2024-11-05 23:50:08 +04:00
parent 2539ec26b5
commit 3d709d3b57
25 changed files with 306 additions and 134 deletions

View File

@ -89,7 +89,6 @@ namespace EventVisitorClientApp.Controllers
Name = name, Name = name,
Surname = surname, Surname = surname,
LastName = lastname, LastName = lastname,
Role = role,
OrganizationName = organizationName, OrganizationName = organizationName,
Phone = phone, Phone = phone,
Email = login, Email = login,
@ -99,7 +98,6 @@ namespace EventVisitorClientApp.Controllers
APIClient.Client.Name = name; APIClient.Client.Name = name;
APIClient.Client.Surname = surname; APIClient.Client.Surname = surname;
APIClient.Client.LastName = lastname; APIClient.Client.LastName = lastname;
APIClient.Client.Role = role;
APIClient.Client.OrganizationName = organizationName; APIClient.Client.OrganizationName = organizationName;
APIClient.Client.Phone = phone; APIClient.Client.Phone = phone;
APIClient.Client.Email = login; APIClient.Client.Email = login;
@ -114,7 +112,7 @@ namespace EventVisitorClientApp.Controllers
} }
[HttpPost] [HttpPost]
public void Register(string login, string password, string surname, string name, string lastname, string role, string organizationName, string phone, string code) public void Register(string login, string password, string surname, string name, string lastname, string organizationName, string phone, string code)
{ {
if (string.IsNullOrEmpty(login)) if (string.IsNullOrEmpty(login))
{ {
@ -136,17 +134,12 @@ namespace EventVisitorClientApp.Controllers
{ {
throw new Exception("Ââåäèòå íàçâàíèå îðãàíèçàöèè"); throw new Exception("Ââåäèòå íàçâàíèå îðãàíèçàöèè");
} }
if (string.IsNullOrEmpty(role))
{
throw new Exception("Ââåäèòå ðîëü");
}
APIClient.PostRequest("api/Organizer/Register", new OrganizerBindingModel APIClient.PostRequest("api/Organizer/Register", new OrganizerBindingModel
{ {
Name = name, Name = name,
Surname = surname, Surname = surname,
LastName = lastname, LastName = lastname,
Role = role,
OrganizationName = organizationName, OrganizationName = organizationName,
Phone = phone, Phone = phone,
Email = login, Email = login,
@ -162,8 +155,18 @@ namespace EventVisitorClientApp.Controllers
{ {
return Redirect("~/Home/Enter"); return Redirect("~/Home/Enter");
} }
return View(APIClient.GetRequest<List<EventViewModel>>($"api/main/GetEventList?ClientId={APIClient.Client.Id}")); return View(APIClient.GetRequest<List<EventViewModel>>($"api/main/GetEventList?OrganizerId={APIClient.Client.Id}"));
} }
public IActionResult Visitors(int id)
{
if (APIClient.Client == null)
{
return Redirect("~/Home/Enter");
}
return View(APIClient.GetRequest<List<VisitorViewModel>>($"api/main/GetVisitorList?EventId={id}"));
}
public IActionResult CreateEvent() public IActionResult CreateEvent()
{ {
if (APIClient.Client == null) if (APIClient.Client == null)
@ -192,10 +195,19 @@ namespace EventVisitorClientApp.Controllers
return View(eventDetails); return View(eventDetails);
} }
public IActionResult ResultRegistration()
{
return View();
}
[HttpPost] [HttpPost]
public void RegistrationOnEvent(int id, string name, string phone, string email, DateTime dayBirth) public void RegistrationOnEvent(int id, string name, string phone, string email, DateTime dayBirth)
{ {
var eventDetails = APIClient.GetRequest<EventViewModel>($"api/main/GetEvent?EventId={id}");
if (eventDetails != null && eventDetails.FreePlaces > 0)
{
int updatedFreePlaces = eventDetails.FreePlaces - 1;
APIClient.PostRequest("api/main/registrationonevent", new VisitorBindingModel APIClient.PostRequest("api/main/registrationonevent", new VisitorBindingModel
{ {
Name = name, Name = name,
@ -205,13 +217,33 @@ namespace EventVisitorClientApp.Controllers
EventId = id, EventId = id,
Status = "Çàðåãèñòèðîâàí" Status = "Çàðåãèñòèðîâàí"
}); });
// 4. Îáíîâèòå êîëè÷åñòâî ñâîáîäíûõ ìåñò
APIClient.PostRequest("api/main/updateevent", new EventBindingModel
{
Id = id,
Name = eventDetails.Name,
Description = eventDetails.Description,
Type = eventDetails.Type,
ContactPhone = eventDetails.ContactPhone,
Address = eventDetails.Address,
City = eventDetails.City,
Status = eventDetails.Status,
ContactEmail = eventDetails.ContactEmail,
TimeEnd = eventDetails.TimeEnd.ToUniversalTime(),
TimeStart = eventDetails.TimeStart.ToUniversalTime(),
Date = eventDetails.Date.ToUniversalTime(),
CountVisitors = eventDetails.CountVisitors,
OrganizerId = eventDetails.OrganizerId,
Link = eventDetails.Link,
FreePlaces = updatedFreePlaces
});
Response.Redirect("ResultRegistration"); Response.Redirect("ResultRegistration");
} }
else
[HttpGet]
public IActionResult ResultRegistration()
{ {
return View(); Response.Redirect("NoFreePlaces");
}
} }
[HttpPost] [HttpPost]

View File

@ -40,16 +40,6 @@
<input type="text" name="organizationName" class="form-control" id="InputCompany"> <input type="text" name="organizationName" class="form-control" id="InputCompany">
</div> </div>
<div class="mb-4">
<label for="InputRole" class="form-label" style="font-size: 24px">Выберите роль</label>
<select name="role" class="form-control" id="InputRole" required>
<option value="" disabled selected>Выберите роль</option>
<option value="Организатор">Организатор</option>
<option value="Регистратор">Регистратор</option>
</select>
<div class="invalid-feedback">Пожалуйста, выберите роль.</div>
</div>
<div class="mb-4"> <div class="mb-4">
<label for="InputP" class="form-label" style="font-size: 24px">Введите номер телефона</label> <label for="InputP" class="form-label" style="font-size: 24px">Введите номер телефона</label>
<input type="text" name="phone" class="form-control" id="InputP" required> <input type="text" name="phone" class="form-control" id="InputP" required>

View File

@ -2,9 +2,20 @@
@model EventViewModel @model EventViewModel
@{ @{
Layout = null;
ViewData["Title"] = "RegistrationOnEvent"; ViewData["Title"] = "RegistrationOnEvent";
} }
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - EventVisitorClientApp</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
<link rel="stylesheet" href="~/EventVisitorClientApp.styles.css" asp-append-version="true" />
</head>
<div class="container mt-5"> <div class="container mt-5">
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
@ -62,13 +73,15 @@
</div> </div>
<div class="mb-4"> <div class="mb-4">
<button type="submit" class="btn btn-dark btn-lg w-100">Зарегистрироваться</button> <button type="submit" class="btn btn-dark btn-lg w-100" onclick="submitForm()">Зарегистрироваться</button>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</html>
<style> <style>
.containerenter { .containerenter {

View File

@ -1,7 +1,15 @@
@{ @{
Layout = null;
ViewData["Title"] = "Успешная регистрация"; ViewData["Title"] = "Успешная регистрация";
} }
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - EventVisitorClientApp</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
<link rel="stylesheet" href="~/EventVisitorClientApp.styles.css" asp-append-version="true" />
</head>
<div class="container enter mt-5"> <div class="container enter mt-5">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">

View File

@ -52,7 +52,7 @@
</div> </div>
</div> </div>
<a class="btn btn-dark btn-block mb-4" asp-action="RegistrationOnEvent" asp-route-id="@Model.Id">Страница с регистрацией</a> <a class="btn btn-dark btn-block mb-4" asp-action="RegistrationOnEvent" asp-route-id="@Model.Id">Страница с регистрацией</a>
<button type="submit" class="btn btn-black btn-block">Зарегистрованные пользователи</button> <a class="btn btn-dark btn-block mb-4" asp-action="Visitors" asp-route-id="@Model.Id">Зарегистрированные пользователи</a>
</div> </div>
</div> </div>
</div> </div>

View File

@ -0,0 +1,72 @@
@using EventVisitorLogic.ViewModels
@model List<VisitorViewModel>
@{
ViewData["Title"] = "Зарегистрированные пользователи";
}
<div class="container mt-5">
<div class="text-center">
<h1 class="display-4">Зарегистрированные пользователи</h1>
</div>
<div class="text-center mt-4">
@{
<table class="table table-striped table-bordered mt-4">
<thead class="thead-light">
<tr>
<th>Имя</th>
<th>Почта</th>
<th>Телефон</th>
<th>Дата рождения</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>@Html.DisplayFor(modelItem => item.Name)</td>
<td>@Html.DisplayFor(modelItem => item.Email)</td>
<td>@Html.DisplayFor(modelItem => item.Phone)</td>
<td>@Html.DisplayFor(modelItem => item.DayBirth)</td>
<td>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="present_@item.Id" name="present_@item.Id" value="true">
<label class="form-check-label" for="present_@item.Id">Да</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="not_present_@item.Id" name="not_present_@item.Id" value="true">
<label class="form-check-label" for="not_present_@item.Id">Нет</label>
</div>
</td>
</tr>
}
</tbody>
</table>
}
</div>
</div>
<style>
body {
background-color: #f8f9fa;
}
.table {
margin-top: 20px;
}
.btn {
transition: background-color 0.3s ease;
}
.btn-light {
background-color: #e9ecef; /* Светло-серый цвет */
color: #495057; /* Тёмный текст для контраста */
}
.btn-light:hover {
background-color: #d3d3d3; /* Более тёмный светло-серый при наведении */
}
</style>

View File

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

View File

@ -42,11 +42,6 @@
</main> </main>
</div> </div>
<footer class="border-top footer text-muted">
<div class="container">
&copy; 2024 - EventVisitorClientApp - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
</div>
</footer>
<script src="~/lib/jquery/dist/jquery.min.js"></script> <script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script> <script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script> <script src="~/js/site.js" asp-append-version="true"></script>

View File

@ -46,6 +46,7 @@ namespace EventVisitorDatabase.Entities
public int OrganizerId { get; set; } public int OrganizerId { get; set; }
public string Link { get; set; } = string.Empty; public string Link { get; set; } = string.Empty;
public virtual OrganizerEntity Organizer { get; set; }
public static EventEntity? Create(EventBindingModel model) public static EventEntity? Create(EventBindingModel model)

View File

@ -22,8 +22,7 @@ namespace EventVisitorDatabase.Entities
public string Name { get; set; } = string.Empty; public string Name { get; set; } = string.Empty;
public string LastName { get; set; } = string.Empty; public string LastName { get; set; } = string.Empty;
public string OrganizationName { get; set; } = string.Empty; public string OrganizationName { get; set; } = string.Empty;
[Required]
public string Role { get; set; } = string.Empty;
[Required] [Required]
public string Email { get; set; } = string.Empty; public string Email { get; set; } = string.Empty;
[Required] [Required]
@ -44,7 +43,6 @@ namespace EventVisitorDatabase.Entities
Id = model.Id, Id = model.Id,
Name = model.Name, Name = model.Name,
Phone = model.Phone, Phone = model.Phone,
Role = model.Role,
Surname = model.Surname, Surname = model.Surname,
LastName = model.LastName, LastName = model.LastName,
OrganizationName = model.OrganizationName, OrganizationName = model.OrganizationName,
@ -60,7 +58,6 @@ namespace EventVisitorDatabase.Entities
Id = model.Id, Id = model.Id,
Name = model.Name, Name = model.Name,
Phone = model.Phone, Phone = model.Phone,
Role = model.Role,
Surname = model.Surname, Surname = model.Surname,
LastName = model.LastName, LastName = model.LastName,
OrganizationName = model.OrganizationName, OrganizationName = model.OrganizationName,
@ -74,7 +71,6 @@ namespace EventVisitorDatabase.Entities
{ {
Name = model.Name; Name = model.Name;
Phone = model.Phone; Phone = model.Phone;
Role = model.Role;
Surname = model.Surname; Surname = model.Surname;
LastName = model.LastName; LastName = model.LastName;
OrganizationName = model.OrganizationName; OrganizationName = model.OrganizationName;
@ -86,7 +82,6 @@ namespace EventVisitorDatabase.Entities
Id = Id, Id = Id,
Name = Name, Name = Name,
Phone = Phone, Phone = Phone,
Role = Role,
Surname = Surname, Surname = Surname,
LastName = LastName, LastName = LastName,
OrganizationName = OrganizationName, OrganizationName = OrganizationName,

View File

@ -35,6 +35,15 @@ namespace EventVisitorDatabase.Implements
.GetViewModel; .GetViewModel;
} }
public List<EventViewModel> GetFilteredList(EventBindingModel model)
{
using var context = new EventVisitorDbContext();
return context.Events
.Include(x => x.Organizer)
.Where(x => x.OrganizerId == model.OrganizerId).Select(x => x.GetViewModel).ToList();
}
public List<EventViewModel> GetFullList() public List<EventViewModel> GetFullList()
{ {
using var context = new EventVisitorDbContext(); using var context = new EventVisitorDbContext();

View File

@ -27,6 +27,19 @@ namespace EventVisitorDatabase.Implements
return null; return null;
} }
public List<VisitorViewModel> GetFilteredList(VisitorBindingModel model)
{
if (model.EventId < 0)
{
return new();
}
using var context = new EventVisitorDbContext();
return context.Visitors
.Include(x => x.Event)
.Where(x => x.EventId == model.EventId).Select(x => x.GetViewModel).ToList();
}
public VisitorViewModel? GetElement(VisitorBindingModel model) public VisitorViewModel? GetElement(VisitorBindingModel model)
{ {
if (model.Id < 0) if (model.Id < 0)

View File

@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace EventVisitorDatabase.Migrations namespace EventVisitorDatabase.Migrations
{ {
[DbContext(typeof(EventVisitorDbContext))] [DbContext(typeof(EventVisitorDbContext))]
[Migration("20241104161237_InitialCreate")] [Migration("20241105194655_InitialCreate")]
partial class InitialCreate partial class InitialCreate
{ {
/// <inheritdoc /> /// <inheritdoc />
@ -89,6 +89,8 @@ namespace EventVisitorDatabase.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("OrganizerId");
b.ToTable("Events"); b.ToTable("Events");
}); });
@ -124,10 +126,6 @@ namespace EventVisitorDatabase.Migrations
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Role")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Surname") b.Property<string>("Surname")
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
@ -174,6 +172,17 @@ namespace EventVisitorDatabase.Migrations
b.ToTable("Visitors"); b.ToTable("Visitors");
}); });
modelBuilder.Entity("EventVisitorDatabase.Entities.EventEntity", b =>
{
b.HasOne("EventVisitorDatabase.Entities.OrganizerEntity", "Organizer")
.WithMany()
.HasForeignKey("OrganizerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Organizer");
});
modelBuilder.Entity("EventVisitorDatabase.Entities.VisitorEntity", b => modelBuilder.Entity("EventVisitorDatabase.Entities.VisitorEntity", b =>
{ {
b.HasOne("EventVisitorDatabase.Entities.EventEntity", "Event") b.HasOne("EventVisitorDatabase.Entities.EventEntity", "Event")

View File

@ -12,6 +12,25 @@ namespace EventVisitorDatabase.Migrations
/// <inheritdoc /> /// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.CreateTable(
name: "Organizers",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Surname = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
LastName = table.Column<string>(type: "text", nullable: false),
OrganizationName = table.Column<string>(type: "text", nullable: false),
Email = table.Column<string>(type: "text", nullable: false),
Password = table.Column<string>(type: "text", nullable: false),
Phone = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Organizers", x => x.Id);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "Events", name: "Events",
columns: table => new columns: table => new
@ -37,26 +56,12 @@ namespace EventVisitorDatabase.Migrations
constraints: table => constraints: table =>
{ {
table.PrimaryKey("PK_Events", x => x.Id); table.PrimaryKey("PK_Events", x => x.Id);
}); table.ForeignKey(
name: "FK_Events_Organizers_OrganizerId",
migrationBuilder.CreateTable( column: x => x.OrganizerId,
name: "Organizers", principalTable: "Organizers",
columns: table => new principalColumn: "Id",
{ onDelete: ReferentialAction.Cascade);
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Surname = table.Column<string>(type: "text", nullable: false),
Name = table.Column<string>(type: "text", nullable: false),
LastName = table.Column<string>(type: "text", nullable: false),
OrganizationName = table.Column<string>(type: "text", nullable: false),
Role = table.Column<string>(type: "text", nullable: false),
Email = table.Column<string>(type: "text", nullable: false),
Password = table.Column<string>(type: "text", nullable: false),
Phone = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Organizers", x => x.Id);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
@ -83,6 +88,11 @@ namespace EventVisitorDatabase.Migrations
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateIndex(
name: "IX_Events_OrganizerId",
table: "Events",
column: "OrganizerId");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "IX_Visitors_EventId", name: "IX_Visitors_EventId",
table: "Visitors", table: "Visitors",
@ -92,14 +102,14 @@ namespace EventVisitorDatabase.Migrations
/// <inheritdoc /> /// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder)
{ {
migrationBuilder.DropTable(
name: "Organizers");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Visitors"); name: "Visitors");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "Events"); name: "Events");
migrationBuilder.DropTable(
name: "Organizers");
} }
} }
} }

View File

@ -86,6 +86,8 @@ namespace EventVisitorDatabase.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("OrganizerId");
b.ToTable("Events"); b.ToTable("Events");
}); });
@ -121,10 +123,6 @@ namespace EventVisitorDatabase.Migrations
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Role")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Surname") b.Property<string>("Surname")
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
@ -171,6 +169,17 @@ namespace EventVisitorDatabase.Migrations
b.ToTable("Visitors"); b.ToTable("Visitors");
}); });
modelBuilder.Entity("EventVisitorDatabase.Entities.EventEntity", b =>
{
b.HasOne("EventVisitorDatabase.Entities.OrganizerEntity", "Organizer")
.WithMany()
.HasForeignKey("OrganizerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Organizer");
});
modelBuilder.Entity("EventVisitorDatabase.Entities.VisitorEntity", b => modelBuilder.Entity("EventVisitorDatabase.Entities.VisitorEntity", b =>
{ {
b.HasOne("EventVisitorDatabase.Entities.EventEntity", "Event") b.HasOne("EventVisitorDatabase.Entities.EventEntity", "Event")

View File

@ -14,15 +14,8 @@ namespace EventVisitorLogic.BindingModels
public string Name { get; set; } = string.Empty; public string Name { get; set; } = string.Empty;
public string LastName { get; set; } = string.Empty; public string LastName { get; set; } = string.Empty;
public string OrganizationName { get; set; } = string.Empty; public string OrganizationName { get; set; } = string.Empty;
public string Role { get; set; } = string.Empty;
public string Phone { get; set; } = string.Empty; public string Phone { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty; public string Email { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty; public string Password { get; set; } = string.Empty;
public Dictionary<int, IEventModel> OrganizerEvent
{
get;
set;
} = new();
} }
} }

View File

@ -54,8 +54,7 @@ namespace EventVisitorLogic.Logic
public List<EventViewModel>? ReadList(EventBindingModel? model) public List<EventViewModel>? ReadList(EventBindingModel? model)
{ {
//var list = model == null ? _eventStorage.GetFullList() : _eventStorage.GetFilteredList(model); var list = model == null ? _eventStorage.GetFullList() : _eventStorage.GetFilteredList(model);
var list = _eventStorage.GetFullList();
if (list == null) if (list == null)
{ {
return null; return null;

View File

@ -95,10 +95,6 @@ namespace EventVisitorLogic.Logic
{ {
throw new ArgumentNullException("Нет названия компании", nameof(model.OrganizationName)); throw new ArgumentNullException("Нет названия компании", nameof(model.OrganizationName));
} }
if (string.IsNullOrEmpty(model.Role))
{
throw new ArgumentNullException("Нет роли", nameof(model.Role));
}
if (string.IsNullOrEmpty(model.Phone)) if (string.IsNullOrEmpty(model.Phone))
{ {
throw new ArgumentNullException("Нет телефона", nameof(model.Phone)); throw new ArgumentNullException("Нет телефона", nameof(model.Phone));

View File

@ -54,8 +54,7 @@ namespace EventVisitorLogic.Logic
public List<VisitorViewModel>? ReadList(VisitorBindingModel? model) public List<VisitorViewModel>? ReadList(VisitorBindingModel? model)
{ {
//var list = model == null ? _organizerStorage.GetFullList() : _organizerStorage.GetFilteredList(model); var list = model == null ? _visitorStorage.GetFullList() : _visitorStorage.GetFilteredList(model);
var list = _visitorStorage.GetFullList();
if (list == null) if (list == null)
{ {
return null; return null;

View File

@ -12,7 +12,7 @@ namespace EventVisitorLogic.StoragesContracts
public interface IEventStorage public interface IEventStorage
{ {
List<EventViewModel> GetFullList(); List<EventViewModel> GetFullList();
// List<Event> GetFilteredList(Event model); List<EventViewModel> GetFilteredList(EventBindingModel model);
EventViewModel? GetElement(EventBindingModel model); EventViewModel? GetElement(EventBindingModel model);
EventViewModel? Insert(EventBindingModel model); EventViewModel? Insert(EventBindingModel model);
EventViewModel? Update(EventBindingModel model); EventViewModel? Update(EventBindingModel model);

View File

@ -12,7 +12,6 @@ namespace EventVisitorLogic.StoragesContracts
public interface IOrganizerStorage public interface IOrganizerStorage
{ {
List<OrganizerViewModel> GetFullList(); List<OrganizerViewModel> GetFullList();
// List<Organizer> GetFilteredList(Organizer model);
OrganizerViewModel? GetElement(OrganizerBindingModel model); OrganizerViewModel? GetElement(OrganizerBindingModel model);
OrganizerViewModel? Insert(OrganizerBindingModel model); OrganizerViewModel? Insert(OrganizerBindingModel model);
OrganizerViewModel? Update(OrganizerBindingModel model); OrganizerViewModel? Update(OrganizerBindingModel model);

View File

@ -12,7 +12,7 @@ namespace EventVisitorLogic.StoragesContracts
public interface IVisitorStorage public interface IVisitorStorage
{ {
List<VisitorViewModel> GetFullList(); List<VisitorViewModel> GetFullList();
//List<Visitor> GetFilteredList(Visitor model); List<VisitorViewModel> GetFilteredList(VisitorBindingModel model);
VisitorViewModel? GetElement(VisitorBindingModel model); VisitorViewModel? GetElement(VisitorBindingModel model);
VisitorViewModel? Insert(VisitorBindingModel model); VisitorViewModel? Insert(VisitorBindingModel model);
VisitorViewModel? Update(VisitorBindingModel model); VisitorViewModel? Update(VisitorBindingModel model);

View File

@ -14,7 +14,6 @@ namespace EventVisitorLogic.ViewModels
public string Name { get; set; } = string.Empty; public string Name { get; set; } = string.Empty;
public string LastName { get; set; } = string.Empty; public string LastName { get; set; } = string.Empty;
public string OrganizationName { get; set; } = string.Empty; public string OrganizationName { get; set; } = string.Empty;
public string Role { get; set; } = string.Empty;
public string Phone { get; set; } = string.Empty; public string Phone { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty; public string Email { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty; public string Password { get; set; } = string.Empty;

View File

@ -13,7 +13,6 @@ namespace EventVisitorModels
public string Name { get; set; } = string.Empty; public string Name { get; set; } = string.Empty;
public string LastName { get; set; } = string.Empty; public string LastName { get; set; } = string.Empty;
public string OrganizationName { get; set; } = string.Empty; public string OrganizationName { get; set; } = string.Empty;
public string Role { get; set; } = string.Empty;
public string Phone { get; set; } = string.Empty; public string Phone { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty; public string Email { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty; public string Password { get; set; } = string.Empty;

View File

@ -40,6 +40,26 @@ namespace EventVisitorRestApi.Controllers
} }
} }
[HttpGet]
public List<VisitorViewModel>? GetVisitorList(int eventId)
{
try
{
if (eventId == null)
{
return _visitor.ReadList(null);
}
return _visitor.ReadList(new VisitorBindingModel
{
EventId = eventId
});
}
catch (Exception ex)
{
throw;
}
}
[HttpPost] [HttpPost]
public void CreateEvent(EventBindingModel model) public void CreateEvent(EventBindingModel model)
{ {