project_db + models
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user