2024-11-03 01:20:30 +04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Net.NetworkInformation;
|
|
|
|
|
using System.Net;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
|
|
|
|
using EventVisitorLogic.BindingModels;
|
|
|
|
|
using EventVisitorLogic.ViewModels;
|
2024-11-03 10:18:08 +04:00
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
2024-11-03 01:20:30 +04:00
|
|
|
|
|
|
|
|
|
namespace EventVisitorDatabase.Entities
|
|
|
|
|
{
|
|
|
|
|
public class OrganizerEntity
|
|
|
|
|
{
|
|
|
|
|
public int Id { get; set; }
|
2024-11-03 10:18:08 +04:00
|
|
|
|
[Required]
|
2024-11-03 01:20:30 +04:00
|
|
|
|
public string Surname { get; set; } = string.Empty;
|
2024-11-03 10:18:08 +04:00
|
|
|
|
[Required]
|
2024-11-03 01:20:30 +04:00
|
|
|
|
public string Name { get; set; } = string.Empty;
|
|
|
|
|
public string LastName { get; set; } = string.Empty;
|
|
|
|
|
public string OrganizationName { get; set; } = string.Empty;
|
2024-11-05 23:50:08 +04:00
|
|
|
|
|
2024-11-03 10:18:08 +04:00
|
|
|
|
[Required]
|
2024-11-03 19:42:19 +04:00
|
|
|
|
public string Email { get; set; } = string.Empty;
|
|
|
|
|
[Required]
|
|
|
|
|
public string Password { get; set; } = string.Empty;
|
|
|
|
|
[Required]
|
2024-11-03 01:20:30 +04:00
|
|
|
|
public string Phone { get; set; } = string.Empty;
|
|
|
|
|
|
2024-11-04 19:46:16 +04:00
|
|
|
|
|
2024-11-03 01:20:30 +04:00
|
|
|
|
|
|
|
|
|
public static OrganizerEntity? Create(OrganizerBindingModel model)
|
|
|
|
|
{
|
|
|
|
|
if (model == null)
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return new OrganizerEntity()
|
|
|
|
|
{
|
2024-11-03 19:42:19 +04:00
|
|
|
|
Id = model.Id,
|
2024-11-03 01:20:30 +04:00
|
|
|
|
Name = model.Name,
|
|
|
|
|
Phone = model.Phone,
|
|
|
|
|
Surname = model.Surname,
|
|
|
|
|
LastName = model.LastName,
|
2024-11-03 19:42:19 +04:00
|
|
|
|
OrganizationName = model.OrganizationName,
|
|
|
|
|
Email = model.Email,
|
|
|
|
|
Password = model.Password
|
2024-11-03 01:20:30 +04:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static OrganizerEntity Create(OrganizerViewModel model)
|
|
|
|
|
{
|
|
|
|
|
return new OrganizerEntity()
|
|
|
|
|
{
|
|
|
|
|
Id = model.Id,
|
|
|
|
|
Name = model.Name,
|
|
|
|
|
Phone = model.Phone,
|
|
|
|
|
Surname = model.Surname,
|
|
|
|
|
LastName = model.LastName,
|
2024-11-03 19:42:19 +04:00
|
|
|
|
OrganizationName = model.OrganizationName,
|
|
|
|
|
Email = model.Email,
|
|
|
|
|
Password= model.Password
|
2024-11-03 01:20:30 +04:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void Update(OrganizerBindingModel model)
|
|
|
|
|
{
|
|
|
|
|
Name = model.Name;
|
|
|
|
|
Phone = model.Phone;
|
|
|
|
|
Surname = model.Surname;
|
|
|
|
|
LastName = model.LastName;
|
|
|
|
|
OrganizationName = model.OrganizationName;
|
2024-11-03 19:42:19 +04:00
|
|
|
|
Password = model.Password;
|
2024-11-03 01:20:30 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public OrganizerViewModel GetViewModel => new()
|
|
|
|
|
{
|
|
|
|
|
Id = Id,
|
|
|
|
|
Name = Name,
|
|
|
|
|
Phone = Phone,
|
|
|
|
|
Surname = Surname,
|
|
|
|
|
LastName = LastName,
|
2024-11-03 19:42:19 +04:00
|
|
|
|
OrganizationName = OrganizationName,
|
|
|
|
|
Email = Email,
|
|
|
|
|
Password = Password
|
2024-11-03 01:20:30 +04:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|