Beispiel #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IOrderDbService service)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            /*
             * app.Use(async (context, next) => {
             *
             *  if (!context.Request.Headers.ContainsKey("Index"))
             *  {
             *      context.Response.StatusCode = StatusCodes.Status401Unauthorized;
             *      await context.Response.WriteAsync("index is required"); //message  (async varsa await de olmali)
             *
             *      return; //short circutting  not passing to the next middleware direk response yolluyoruz ilerlemeden
             *  }
             *
             *  string index = context.Request.Headers["Index"].ToString();
             *  var student = service.GetStudentbyIndex(index);
             *  if (student == null)
             *  {
             *      context.Response.StatusCode = StatusCodes.Status400BadRequest;
             *      await context.Response.WriteAsync("Incorrect Index!!");
             *      return;
             *  }
             *  await next(); //calls next middle ware
             *
             * });
             */

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Beispiel #2
0
 public OrderController(IOrderDbService orderDbService)
 {
     dbService = orderDbService;
 }
Beispiel #3
0
 public NewOrderController(IOrderDbService service)
 {
     _service = service;
 }
 public OrdersController(IOrderDbService service)
 {
     _service = service;
 }
Beispiel #5
0
 public CustomerController(IOrderDbService service)
 {
     _service = service;
 }
 public OrderController(IOrderDbService dbService)
 {
     _dbService = dbService;
 }
 public ClientsController(IOrderDbService service)
 {
     _service = service;
 }