Example #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers().SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
            .AddNewtonsoftJson(options =>
            {
                options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
            });

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "CCTVSystem", Version = "Version 1.0"
                });
            });

            services.AddHangfire(config =>
                                 config.UseSqlServerStorage(Configuration.GetConnectionString("HangfireConnection")));
            services.AddHangfireServer();
            services.Configure <IdentityOptions>(options => options.ClaimsIdentity.UserIdClaimType = ClaimTypes.NameIdentifier);
            services.AddDbContext <CctvDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"), b => b.MigrationsAssembly("CCTVSystem")));
            services.AddHttpContextAccessor();

            services.AddIdentity <Client, IdentityRole>(config =>
            {
                // password configuration
                config.Password.RequiredLength         = 8;
                config.Password.RequireDigit           = true;
                config.Password.RequireNonAlphanumeric = false;
                config.Password.RequireUppercase       = true;
            })
            .AddEntityFrameworkStores <CctvDbContext>();

            MapperSetup.Configurate();
            SetIOC(services);
        }
Example #2
0
        // 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();
                app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
                {
                    HotModuleReplacement      = true,
                    ReactHotModuleReplacement = true
                });
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

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

                routes.MapSpaFallbackRoute(
                    name: "spa-fallback",
                    defaults: new { controller = "Home", action = "Index" });
            });

            MapperSetup.Setup();
        }
Example #3
0
 static void Main(string[] args)
 {
     MapperSetup.Setup();
     ActivityLounge activityLounge = new ActivityLounge();
     var            groups         = activityLounge.GetAllGroups(4);
     //foreach (var item in groups)
     //{
     //    System.Console.WriteLine(item.Activities.Count);
     //    if(item.Activities.Count > 0)
     //    {
     //        var activity = item.Activities.First();
     //        System.Console.WriteLine(activity.ActivityName);
     //    }
     //}
 }
Example #4
0
 public SystemControllerSpec()
 {
     _loggerFactory = Substitute.For <ILoggerFactory>();
     _swarmClient   = Substitute.For <ISwarmClient>();
     MapperSetup.Init();
 }
Example #5
0
 public static void RegisterMapper(ContainerBuilder builder)
 {
     builder.Register(context => MapperSetup.GetMapper()).As <IMapper>();
 }
Example #6
0
 public MapperSpec()
 {
     MapperSetup.Init();
 }
Example #7
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     MapperSetup.Setup();
 }
Example #8
0
 public void SetupMapper()
 {
     MapperSetup.RegisterProfiles(MapperConfig.GetProfiles());
 }