using ElectricalRepairServiceContract.Exceptions; using ElectricalRepairServiceContract.Extensions; using ElectricalRepairServiceContract.Interfaces; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace ElectricalRepairServiceContract.DataModels { public class EmploeeDataModel : IValidation { public string Id { get; private set; } public string Name { get; private set; } public string PostId { get; private set; } public EmploeeDataModel(string id, string name, string postId) { Id = id; Name = name; PostId = postId; } public void Validate() { 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"); if (Name.IsEmpty()) throw new ValidationException("Field Name is empty"); if (PostId.IsEmpty()) throw new ValidationException("Field PostId is empty"); if (!PostId.IsGuid()) throw new ValidationException("The value in the field PostId is not a unique identifier"); } } }