using System;
using System.Linq;
using Quadarax.Foundation.Core.Data.Interface.Entity;
using Quadarax.Foundation.Core.Data.Interface.Entity.Dto;

namespace BO.AppServer.Metadata.Extensions
{
    public static class ResultValueExt
    {

        public static bool HasNoDataException<TDto>(this ResultValueDto<TDto> result) where TDto : IDto, new()
        {
            if (result == null)
                throw new ArgumentNullException(nameof(result));

            return result.Errors.Any(x => x.Code == 1099);
        }

        public static bool HasNoDataException<TDto>(this ResultsValueDto<TDto> result) where TDto : IDto, new()
        {
            if (result == null)
                throw new ArgumentNullException(nameof(result));

            return result.Errors.Any(x => x.Code == 1099);
        }
    }
}
