34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using NorthBridgeContract.Exceptions;
|
|
using NorthBridgeContract.Extensions;
|
|
using NorthBridgeContract.Infrastructure;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace NorthBridgeContract.DataModels
|
|
{
|
|
public class SupplyDataModel(string id, string storageId, DateTime date) : IValidation
|
|
{
|
|
public string Id { get; private set; } = id;
|
|
public string StorageId { get; private set; } = storageId;
|
|
public DateTime Date { get; private set; } = date;
|
|
|
|
public void Validate()
|
|
{
|
|
if (StorageId.IsEmpty())
|
|
throw new ValidationException("Field StorageId is empty");
|
|
|
|
if (!StorageId.IsGuid())
|
|
throw new ValidationException("The value in the field StorageId is not a unique identifier");
|
|
|
|
if (Id.IsEmpty())
|
|
throw new ValidationException("Field Id is empty");
|
|
|
|
if (!Id.IsGuid())
|
|
throw new ValidationException("The value in the field Id is not a unique identifier");
|
|
}
|
|
}
|
|
}
|