project_db + models

This commit is contained in:
2025-03-12 16:35:56 +04:00
parent 9c06125d66
commit cf45ffb67d
11 changed files with 190 additions and 2 deletions

View File

@@ -4,11 +4,12 @@ using SmallSoftwareContracts.Infrastructure;
namespace SmallSoftwareContracts.DataModels;
public class InstallationRequestDataModel(string softwareId, string requestId, int count) : IValidation
public class InstallationRequestDataModel(string softwareId, string requestId, int count, double price) : IValidation
{
public string SoftwareId { get; private set; } = softwareId;
public string RequestId { get; private set; } = requestId;
public int Count { get; private set; } = count;
public int Count { get; private set; } = count;
public double Price { get; private set; } = price;
public void Validate()
{
if (SoftwareId.IsEmpty())
@@ -21,5 +22,7 @@ public class InstallationRequestDataModel(string softwareId, string requestId, i
throw new ValidationException("The value in the field RequestId is not a unique identifier");
if (Count <= 0)
throw new ValidationException("Field Count is less than or equal to 0");
if (Price <= 0)
throw new ValidationException("Field Price is less than or equal to 0");
}
}