public ApiControllerBuilder()
 {
     _wordService       = null;
     _tagService        = null;
     _appService        = null;
     _requestLogService = null;
 }
Esempio n. 2
0
 public RequestLogController(IConfiguration configuration, ILogger <SecurityController> logger, IUserService userService, IRequestLogService requestLogService)
 {
     _configuration     = configuration;
     _logger            = logger;
     _userService       = userService;
     _requestLogService = requestLogService;
 }
Esempio n. 3
0
 public ApiControllerBuilder()
 {
     _wordService = null;
     _tagService = null;
     _appService = null;
     _requestLogService = null;
 }
Esempio n. 4
0
 public DishesController(IDishService dishService, IRestaurantService restaurantService, IIngredientService ingredientService, IRequestLogService requestLogService)
 {
     _dishService       = dishService;
     _restaurantService = restaurantService;
     _ingredientService = ingredientService;
     _requestLogService = requestLogService;
 }
Esempio n. 5
0
 public SecurityController(SignInManager <User> signInManager, Microsoft.AspNetCore.Identity.UserManager <User> userManager, IConfiguration configuration, ILogger <SecurityController> logger, Microsoft.AspNetCore.Identity.RoleManager <Role> roleManager, IRequestLogService requestLogService)
 {
     _signInManager     = signInManager;
     _userManager       = userManager;
     _configuration     = configuration;
     _logger            = logger;
     _roleManager       = roleManager;
     _requestLogService = requestLogService;
 }
Esempio n. 6
0
 public AccountController(Microsoft.AspNetCore.Identity.UserManager <User> userManager,
                          SignInManager <User> signInManager, Microsoft.AspNetCore.Identity.RoleManager <Role> roleManager,
                          ILogger <AccountController> logger,
                          IUserService userService, IRequestLogService requestLogService)
 {
     _userManager       = userManager;
     _signInManager     = signInManager;
     _roleManager       = roleManager;
     _logger            = logger;
     _userService       = userService;
     _requestLogService = requestLogService;
 }
Esempio n. 7
0
 public ApiController(
     IUserService userService,
     IWordService wordService,
     ITagService tagService,
     IAppService appService,
     IRequestLogService requestLogService,
     IFormsAuthenticationService formsAuthenticationService)
     : base(userService, formsAuthenticationService)
 {
     _wordService       = wordService;
     _tagService        = tagService;
     _appService        = appService;
     _requestLogService = requestLogService;
 }
Esempio n. 8
0
 public ApiController(
     IUserService userService,
     IWordService wordService,
     ITagService tagService,
     IAppService appService,
     IRequestLogService requestLogService,
     IFormsAuthenticationService formsAuthenticationService)
     : base(userService, formsAuthenticationService)
 {
     _wordService = wordService;
     _tagService = tagService;
     _appService = appService;
     _requestLogService = requestLogService;
 }
Esempio n. 9
0
        public async Task Invoke(HttpContext context, IRequestLogService requestLogService)
        {
            _requestLogService = requestLogService;

            _logger.LogInformation(await FormatRequest(context.Request));

            var originalBodyStream = context.Response.Body;

            using (var responseBody = new MemoryStream())
            {
                context.Response.Body = responseBody;

                await _next(context);

                _logger.LogInformation(await FormatResponse(context.Response));

                _requestLogService.CreateRequestLog(context.Request.Method, context.Response.StatusCode.ToString(),
                                                    context.Request.Path, 27214);

                await responseBody.CopyToAsync(originalBodyStream);
            }
        }
Esempio n. 10
0
 internal ApiControllerBuilder WithFormsRequestLogService(IRequestLogService requestLogService)
 {
     _requestLogService = requestLogService;
     return this;
 }
Esempio n. 11
0
 public DashboardController(IBaseControllerServiceFacade baseServiceFacade, IContentItemService contentItemService, IRequestLogService requestLogService) : base(baseServiceFacade)
 {
     _contentItemService = contentItemService;
     _requestLogService = requestLogService;
 }
Esempio n. 12
0
 public AdminController(IRequestLogService requestLogService, RoleManager <IdentityRole> roleManager,
                        UserManager <ApplicationUser> userManager, IConfiguration configuration)
     : base(roleManager, userManager, configuration)
 {
     _requestLogService = requestLogService;
 }
Esempio n. 13
0
 public RequestActionFilter(IRequestLogService requestLogService)
 {
     _requestLogService = requestLogService;
 }
Esempio n. 14
0
 public EnableLogAttribute()
 {
     _logService = DependencyResolver.Current.GetService<IRequestLogService>();
 }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                app.UseHsts();
            }

            app.UseCors(builder =>
                        builder.WithOrigins("http://localhost"));

            //   app.UseRequestResponseLogging

            app.Use(async(context, next) =>
            {
                var sw = new Stopwatch();
                sw.Start();
                await next.Invoke();
                sw.Stop();
                IRequestLogService service = (IRequestLogService)context.RequestServices.GetService(typeof(IRequestLogService));
                var helper = new HttpRequestResponseHelper(service);
                await helper.saveRequestResponseDetails(context, sw);
            });

            app.UseStaticFiles();
            app.UseSpaStaticFiles();

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

            app.UseAuthentication();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller}/{action=Index}/{id?}");
            });


            using (var serviceScope = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>().CreateScope())
            {
                var dbContext = serviceScope.ServiceProvider.GetService <AppDbContext>();

                var roleManager = serviceScope.ServiceProvider.GetService <RoleManager <IdentityRole> >();
                var userManager = serviceScope.ServiceProvider.GetService <UserManager <ApplicationUser> >();

                //  dbContext.Database.Migrate();
                //  DbSeeder.Seed(dbContext, roleManager, userManager);
            }

            app.UseSpa(spa =>
            {
                // To learn more about options for serving an Angular SPA from ASP.NET Core,
                // see https://go.microsoft.com/fwlink/?linkid=864501

                spa.Options.SourcePath = "ClientApp";

                if (env.IsDevelopment())
                {
                    //spa.UseAngularCliServer(npmScript: "start");
                    spa.UseProxyToSpaDevelopmentServer("http://localhost:4200");
                }
            });
        }
Esempio n. 16
0
 internal ApiControllerBuilder WithFormsRequestLogService(IRequestLogService requestLogService)
 {
     _requestLogService = requestLogService;
     return(this);
 }
 public RestaurantsController(IRestaurantService restaurantService, Microsoft.AspNetCore.Identity.UserManager <User> userManager, IRequestLogService requestLogService)
 {
     _restaurantService = restaurantService;
     _userManager       = userManager;
     _requestLogService = requestLogService;
 }
 public RequestLogApiController(IRequestLogService requestLogService)
 {
     _requestLogService = requestLogService;
 }
Esempio n. 19
0
 public HttpRequestResponseHelper(IRequestLogService requestLogService)
 {
     _requestLogService = requestLogService;
 }
Esempio n. 20
0
 public MenusController(IMenuService menuService, IRestaurantService restaurantService, IRequestLogService requestLogService)
 {
     _menuService       = menuService;
     _restaurantService = restaurantService;
     _requestLogService = requestLogService;
 }
Esempio n. 21
0
 /// <summary>
 /// Construct Api log middleware
 /// </summary>
 /// <param name="next">Request delegate</param>
 /// <param name="logService">Log service</param>
 /// <param name="userResolver">User resolver</param>
 public ApiLogMiddleware(RequestDelegate next, IRequestLogService logService, IUserResolver userResolver)
 {
     _next         = next;
     _logService   = logService;
     _userResolver = userResolver;
 }
Esempio n. 22
0
 public PromotionsController(IPromotionService promotionService, IRequestLogService requestLogService)
 {
     _promotionService  = promotionService;
     _requestLogService = requestLogService;
 }
Esempio n. 23
0
 public IngredientsController(IIngredientService ingredientService, IRequestLogService requestLogService)
 {
     _ingredientService = ingredientService;
     _requestLogService = requestLogService;
 }
Esempio n. 24
0
 public RatingLogsController(IRatingLogService ratingLogService, IRequestLogService requestLogService)
 {
     _ratingLogService  = ratingLogService;
     _requestLogService = requestLogService;
 }
Esempio n. 25
0
 public RequestLogController(IRequestLogService requestLogService, IMapper mapper)
 {
     _requestLogService = requestLogService;
     _mapper            = mapper;
 }