fix: добавил списки в дата модель клерка
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
using BankContracts.Exceptions;
|
using System.Text.RegularExpressions;
|
||||||
|
using BankContracts.Exceptions;
|
||||||
using BankContracts.Extensions;
|
using BankContracts.Extensions;
|
||||||
using BankContracts.Infrastructure;
|
using BankContracts.Infrastructure;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
|
|
||||||
namespace BankContracts.DataModels;
|
namespace BankContracts.DataModels;
|
||||||
|
|
||||||
@@ -16,7 +16,22 @@ namespace BankContracts.DataModels;
|
|||||||
/// <param name="password">пароль</param>
|
/// <param name="password">пароль</param>
|
||||||
/// <param name="email">адрес электронной почты</param>
|
/// <param name="email">адрес электронной почты</param>
|
||||||
/// <param name="phoneNumber">номер телефона</param>
|
/// <param name="phoneNumber">номер телефона</param>
|
||||||
public class ClerkDataModel(string id, string name, string surname, string middleName, string login, string password, string email, string phoneNumber) : IValidation
|
/// <param name="deposits">вклады</param>
|
||||||
|
/// <param name="clients">клиенты</param>
|
||||||
|
/// <param name="replenishments">пополнения</param>
|
||||||
|
public class ClerkDataModel(
|
||||||
|
string id,
|
||||||
|
string name,
|
||||||
|
string surname,
|
||||||
|
string middleName,
|
||||||
|
string login,
|
||||||
|
string password,
|
||||||
|
string email,
|
||||||
|
string phoneNumber,
|
||||||
|
List<DepositDataModel> deposits,
|
||||||
|
List<ClientDataModel> clients,
|
||||||
|
List<ReplenishmentDataModel> replenishments
|
||||||
|
) : IValidation
|
||||||
{
|
{
|
||||||
public string Id { get; private set; } = id;
|
public string Id { get; private set; } = id;
|
||||||
|
|
||||||
@@ -34,6 +49,12 @@ public class ClerkDataModel(string id, string name, string surname, string middl
|
|||||||
|
|
||||||
public string PhoneNumber { get; private set; } = phoneNumber;
|
public string PhoneNumber { get; private set; } = phoneNumber;
|
||||||
|
|
||||||
|
public List<DepositDataModel> Deposits { get; private set; } = deposits;
|
||||||
|
|
||||||
|
public List<ClientDataModel> Clients { get; private set; } = clients;
|
||||||
|
|
||||||
|
public List<ReplenishmentDataModel> Replenishments { get; private set; } = replenishments;
|
||||||
|
|
||||||
public void Validate()
|
public void Validate()
|
||||||
{
|
{
|
||||||
if (Id.IsEmpty())
|
if (Id.IsEmpty())
|
||||||
@@ -80,5 +101,17 @@ public class ClerkDataModel(string id, string name, string surname, string middl
|
|||||||
{
|
{
|
||||||
throw new ValidationException("Field PhoneNumber is not a phone number");
|
throw new ValidationException("Field PhoneNumber is not a phone number");
|
||||||
}
|
}
|
||||||
|
if (Deposits is null)
|
||||||
|
{
|
||||||
|
throw new ValidationException("Field Deposits is null");
|
||||||
|
}
|
||||||
|
if (Clients is null)
|
||||||
|
{
|
||||||
|
throw new ValidationException("Field Clients is null");
|
||||||
|
}
|
||||||
|
if (Replenishments is null)
|
||||||
|
{
|
||||||
|
throw new ValidationException("Field Replenishments is null");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class ClientDataModel(string id, string name, string surname, decimal bal
|
|||||||
|
|
||||||
public decimal Balance { get; private set; } = balance;
|
public decimal Balance { get; private set; } = balance;
|
||||||
|
|
||||||
public string Clerkid { get; private set; } = clerkId;
|
public string ClerkId { get; private set; } = clerkId;
|
||||||
|
|
||||||
public void Validate()
|
public void Validate()
|
||||||
{
|
{
|
||||||
@@ -46,11 +46,11 @@ public class ClientDataModel(string id, string name, string surname, decimal bal
|
|||||||
{
|
{
|
||||||
throw new ValidationException("Field Balance is less or equal to zero");
|
throw new ValidationException("Field Balance is less or equal to zero");
|
||||||
}
|
}
|
||||||
if (Clerkid.IsEmpty())
|
if (ClerkId.IsEmpty())
|
||||||
{
|
{
|
||||||
throw new ValidationException("Field Clerkid is null or empty");
|
throw new ValidationException("Field Clerkid is null or empty");
|
||||||
}
|
}
|
||||||
if (!Clerkid.IsGuid())
|
if (!ClerkId.IsGuid())
|
||||||
{
|
{
|
||||||
throw new ValidationException("The value in the field Clerkid is not a unique identifier");
|
throw new ValidationException("The value in the field Clerkid is not a unique identifier");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user