Beispiel #1
0
        protected override void OnBefore(IInvocation invocation)
        {
            var validator  = (IValidator)Activator.CreateInstance(_validatorType);
            var entityType = _validatorType.BaseType.GetGenericArguments()[0];
            var entities   = invocation.Arguments.Where(t => t.GetType() == entityType);

            foreach (var entity in entities)
            {
                ValidationTool.Validator(validator, entity);
            }
        }
Beispiel #2
0
 public IResult Add(Colors color)
 {
     ValidationTool.Validator(new ColorValidator(), color);
     _colorDal.Add(color);
     return(new SuccessResult(Messages.Added));
 }
Beispiel #3
0
 public IResult Add(Users user)
 {
     ValidationTool.Validator(new UserValidator(), user);
     _userDal.Add(user);
     return(new SuccessResult(Messages.Added));
 }
 public IResult Add(Customers customer)
 {
     ValidationTool.Validator(new CustomerValidator(), customer);
     _customerDal.Add(customer);
     return(new SuccessResult(Messages.Added));
 }
Beispiel #5
0
 public IResult Add(Brands brand)
 {
     ValidationTool.Validator(new BrandValidator(), brand);
     _brandDal.Add(brand);
     return(new SuccessResult(Messages.Added));
 }
Beispiel #6
0
 public IResult Add(Rentals rental)
 {
     ValidationTool.Validator(new RentalValidator(), rental);
     _rentalDal.Add(rental);
     return(new SuccessResult(Messages.Added));
 }
Beispiel #7
0
 public IResult Add(Cars car)
 {
     ValidationTool.Validator(new CarValidator(), car);
     _carDal.Add(car);
     return(new SuccessResult(Messages.Added));
 }