public ProductStorageController(IProductStorageRepository
                                 productStorageRepository, DatabaseContext context) : base(productStorageRepository, context)
 {
     _productStorageRepository = productStorageRepository;
     _context = context;
     _entity  = _context.Set <ProductStorageEntity>();
 }
Ejemplo n.º 2
0
        public ProductStateValidator(IDatabaseConnectionFactory databaseConnectionFactory)
        {
            this.productRepository         = RepositoryFactory.CreateProductRepository();
            this.productStorageRepository  = RepositoryFactory.CreateProductStorageRepository();
            this.databaseConnectionFactory = databaseConnectionFactory;

            RuleFor(p => p.Name)
            .Cascade(CascadeMode.StopOnFirstFailure)
            .NotEmpty()
            .Must(ValidateProductName)
            .WithMessage("The product specified doesn't exist in the database");

            RuleFor(p => p)
            .Cascade(CascadeMode.StopOnFirstFailure)
            .NotEmpty()
            .Must(ValidateNotForSoldState)
            .WithMessage("The product can't be set to not for sold state because product is unsold state.")
            .Must(ValidateUnsoldState)
            .WithMessage("The product can't be set to unsold state because product is not for sold state.")
            .Must(ValidateForSoldState)
            .WithMessage("The product can't be set to for sold state because product amount is 0.");
        }
Ejemplo n.º 3
0
 public StorageService(IProductStorageRepository storageRepository, IBatchRepository batchRepository, IUnitOfWork unitOfWork)
 {
     _storageRepository = storageRepository;
     _unitOfWork        = unitOfWork;
     _batchRepository   = batchRepository;
 }
 public ProductStorageService()
 {
     this.productStorageRepository = RepositoryFactory.CreateProductStorageRepository();
 }