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); } }
public IResult Add(Colors color) { ValidationTool.Validator(new ColorValidator(), color); _colorDal.Add(color); return(new SuccessResult(Messages.Added)); }
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)); }
public IResult Add(Brands brand) { ValidationTool.Validator(new BrandValidator(), brand); _brandDal.Add(brand); return(new SuccessResult(Messages.Added)); }
public IResult Add(Rentals rental) { ValidationTool.Validator(new RentalValidator(), rental); _rentalDal.Add(rental); return(new SuccessResult(Messages.Added)); }
public IResult Add(Cars car) { ValidationTool.Validator(new CarValidator(), car); _carDal.Add(car); return(new SuccessResult(Messages.Added)); }