Example #1
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IAppServiceCliente
                              appServiceCliente, IAppServiceProduto appServiceProduto)
        {
            appServiceCliente.AddRange(Application.DataGenerator.getClientes()).ConfigureAwait(false);
            appServiceProduto.AddRange(Application.DataGenerator.getProdutos()).ConfigureAwait(false);

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

            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "DemoApi V1");
            });

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
        }
 public ProdutoController(IAppServiceProduto appService)
 {
     _appService = appService;
 }
Example #3
0
        //public ProdutoController(IAppServiceProduto serviceProduto)
        //{

        //    this._serviceProduto = serviceProduto;
        //}

        public ProdutoController()
        {
            this._serviceProduto = System.Web.Mvc.DependencyResolver.Current.GetService(typeof(IAppServiceProduto)) as IAppServiceProduto;
        }