Exemplo n.º 1
0
        // Use this method to configure the HTTP request pipeline.
        /// <summary>
        ///     Configures the specified application.
        /// </summary>
        /// <param name="app">The application.</param>
        public void Configure(IApplicationBuilder app)
        {
            app.UseDeveloperExceptionPage();
            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthentication(); // add this
            app.UseAuthorization();  // add this

            app.UseSession();

            app.UseEndpoints(endpoints =>
            {
                // route for Admin area
                endpoints.MapAreaControllerRoute(
                    "admin",
                    "Admin",
                    "Admin/{controller=Book}/{action=Index}/{id?}");

                // route for paging, sorting, and filtering
                endpoints.MapControllerRoute(
                    "",
                    "{controller}/{action}/page/{pagenumber}/size/{pagesize}/sort/{sortfield}/{sortdirection}/filter/{type}");

                // route for paging and sorting only
                endpoints.MapControllerRoute(
                    "",
                    "{controller}/{action}/page/{pagenumber}/size/{pagesize}/sort/{sortfield}/{sortdirection}");

                // default route
                endpoints.MapControllerRoute(
                    "default",
                    "{controller=Home}/{action=Index}/{id?}/{slug?}");
            });

            OfficeProductContext.CreateAdminUser(app.ApplicationServices).Wait();
        }
 /// <summary>
 ///     Initializes a new instance of the <see cref="CartController" /> class.
 /// </summary>
 /// <param name="ctx">The CTX.</param>
 public CartController(OfficeProductContext ctx)
 {
     this.Data = new Repository <OfficeProduct>(ctx);
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="ProductsController" /> class.
 /// </summary>
 /// <param name="ctx">The CTX.</param>
 public ProductsController(OfficeProductContext ctx)
 {
     this.Data = new OfficeProductUnitOfWork(ctx);
 }
Exemplo n.º 4
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="OfficeProductUnitOfWork" /> class.
 /// </summary>
 /// <param name="ctx">The CTX.</param>
 public OfficeProductUnitOfWork(OfficeProductContext ctx)
 {
     this.Context = ctx;
 }