private static ThreadService GetThreadService(OnlineForumContext context)
        {
            var mapper = GetMapper();

            var threadService = new ThreadService(context, mapper);

            return(threadService);
        }
Exemplo n.º 2
0
        protected static OnlineForumContext GetNewContext()
        {
            var options = GetOptions();

            var context = new OnlineForumContext(options);

            return(context);
        }
Exemplo n.º 3
0
        private static UserService GetUserService(OnlineForumContext context)
        {
            var mapper = GetMapper();

            var userService = new UserService(context, mapper);

            return(userService);
        }
        private static CommentService GetCommentService(OnlineForumContext context)
        {
            var mapper = GetMapper();

            var commentService = new CommentService(context, mapper);

            return(commentService);
        }
Exemplo n.º 5
0
        public void InitialiseData()
        {
            var options = new DbContextOptionsBuilder <OnlineForumContext>()
                          .UseInMemoryDatabase(databaseName: "ServiceTestsDatabase")
                          .Options;

            var context = new OnlineForumContext(options);

            using (context)
            {
                DbInitializer.InitializeTestData(context);
            }
        }
Exemplo n.º 6
0
 public CommentService(OnlineForumContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
Exemplo n.º 7
0
 public ThreadService(OnlineForumContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
Exemplo n.º 8
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, OnlineForumContext context)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            app.UseCookieAuthentication(new CookieAuthenticationOptions()
            {
                AuthenticationScheme  = "CookieAuthentication",
                LoginPath             = new PathString("/Account/Login"),
                AccessDeniedPath      = new PathString("/Account/Forbidden/"),
                AutomaticAuthenticate = true,
                AutomaticChallenge    = true
            });


            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();
            app.UseSession();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "Users",
                    template: "Users/{userId}",
                    defaults: new { controller = "Users", action = "User" });

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

            DbInitializer.Initialize(context);
        }