コード例 #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ConcesionariosContext concesionariosContext)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            AutoMapper.Mapper.Initialize(cfg =>
            {
                cfg.CreateMap <Entities.Cliente, ClienteResponse>();
                cfg.CreateMap <AddClienteRequest, Entities.Cliente>();
                cfg.CreateMap <UpdateClienteRequest, Entities.Cliente>();
                cfg.CreateMap <Entities.Presupuesto, PresupuestoResponse>();
            });

            concesionariosContext.EnsureSeedDataForContext();

            // Enable middleware to serve generated Swagger as a JSON endpoint.
            app.UseSwagger();

            // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), specifying the Swagger JSON endpoint.
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Concesionarios API");
            });

            // Enable Gzip compression
            // app.UseResponseCompression();

            app.UseMvc();
        }
コード例 #2
0
 public ClientesRepository(ConcesionariosContext context)
 {
     _context = context;
 }