using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using Kreta.Core;
using Kreta.Core.Domain;
using Kreta.Core.Enum;
using Kreta.Core.Exceptions;
namespace Kreta.Ellenorzo.BL.VN.Logic
{
///
/// Author: Kovács Kornél (DevKornél) Created On: 2019.06.
/// Validates the models with "DataAnnotationAttributes" and gives You the option
/// to create custom validation if model implements the "IValidatableObject" interface.
///
internal class ValidatorLogic
{
private readonly List _errorList = new List();
private readonly bool _isValid = true;
internal ValidatorLogic(object instance)
{
var context = new ValidationContext(instance, serviceProvider: null, items: null);
_isValid = Validator.TryValidateObject(instance, context, _errorList, true);
}
internal ValidatorLogic(IEnumerable