protected override bool IsValid(PropertyValidatorContext context)
        {
            var delayProfile = new DelayProfile();
            delayProfile.InjectFrom(context.ParentContext.InstanceToValidate);

            if (!delayProfile.EnableUsenet && !delayProfile.EnableTorrent)
            {
                return false;
            }

            return true;
        }
        protected override bool IsValid(PropertyValidatorContext context)
        {
            if (context.PropertyValue == null) return true;

            var delayProfile = new DelayProfile();
            delayProfile.InjectFrom(context.ParentContext.InstanceToValidate);

            var collection = context.PropertyValue as HashSet<int>;

            if (collection == null || collection.Empty()) return true;

            return _delayProfileService.All().None(d => d.Id != delayProfile.Id && d.Tags.Intersect(collection).Any());
        }
Exemple #3
0
        protected override bool IsValid(PropertyValidatorContext context)
        {
            if (context.PropertyValue == null)
            {
                return(true);
            }

            var delayProfile = new DelayProfile();

            delayProfile.InjectFrom(context.ParentContext.InstanceToValidate);

            var collection = context.PropertyValue as HashSet <int>;

            if (collection == null || collection.Empty())
            {
                return(true);
            }

            return(_delayProfileService.All().None(d => d.Id != delayProfile.Id && d.Tags.Intersect(collection).Any()));
        }
 public DelayProfile Update(DelayProfile profile)
 {
     return _repo.Update(profile);
 }
 public DelayProfile Add(DelayProfile profile)
 {
     return _repo.Insert(profile);
 }
 public DelayProfile Update(DelayProfile profile)
 {
     return(_repo.Update(profile));
 }
 public DelayProfile Add(DelayProfile profile)
 {
     return(_repo.Insert(profile));
 }