public DeleteSupplierCommandValidator(DoenerOrderContext dbContext)
 {
     RuleFor(x => x.Id)
     .NotEmpty()
     .Must(supplierId => dbContext.Suppliers.Any(s => s.Id == supplierId))
     .WithMessage("Supplier does not exist");
 }
 public CreateProductForSupplierCommandValidator(DoenerOrderContext context)
 {
     RuleFor(x => x.SupplierId)
     .NotEmpty()
     .Must(supplierId => context.Suppliers.Any(s => s.Id == supplierId))
     .WithMessage("Supplier does not exist");
     RuleFor(x => x.Label)
     .NotEmpty();
     RuleFor(x => x.Price)
     .NotNull();
 }
Esempio n. 3
0
 public DeleteProductForSupplierCommandValidator(DoenerOrderContext dbContext)
 {
     RuleFor(x => x.SupplierId)
     .NotEmpty()
     .Must(supplierId => dbContext.Suppliers.Any(s => s.Id == supplierId))
     .WithMessage("Supplier does not exist");
     RuleFor(x => x.ProductId)
     .NotEmpty()
     .Must((command, productId) =>
           dbContext.Products.Any(p => p.Id == productId && p.SupplierId == command.SupplierId))
     .WithMessage("Product does not exist.");
 }
Esempio n. 4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, DoenerOrderContext dbContext, AppIdentityDbContext appIdentityDbContext)
        {
            dbContext.Database.Migrate();
            appIdentityDbContext.Database.Migrate();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                SwaggerSetup.ConfigureApplication(app);
            }

            app.UseHttpsRedirection();
            app.UseRouting();

            JwtSetup.ConfigureApplication(app);
            app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
        }
 public GetProductForSupplierByIdQueryHandler(DoenerOrderContext dbContext)
 {
     this.dbContext = dbContext;
 }
Esempio n. 6
0
 public CreateProductForSupplierCommandHandler(DoenerOrderContext dbContext)
 {
     this.dbContext = dbContext;
 }
Esempio n. 7
0
 public DeleteProductForSupplierCommandHandler(DoenerOrderContext context)
 {
     this.context = context;
 }
 public GetAllProductsForSupplierQueryHandler(DoenerOrderContext dbContext)
 {
     this.dbContext = dbContext;
 }
Esempio n. 9
0
 public GetAllSuppliersQueryHandler(DoenerOrderContext dbContext)
 {
     this.dbContext = dbContext;
 }
Esempio n. 10
0
 public UpdateSupplierCommandHandler(DoenerOrderContext dbContext)
 {
     this.dbContext = dbContext;
 }