// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, BookReviewContext context) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); }); SeedData.Seed(context); }
// constructor public ReviewRepository(BookReviewContext c) { context = c; }
public ReviewRepository(BookReviewContext ctx) : base(ctx) { }
public BookReviewRepository(BookReviewContext ctx) { _context = ctx; }
public AuthorRepository(BookReviewContext ctx) : base(ctx) { }
// 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, BookReviewContext bookReviewContext) { loggerFactory.AddConsole(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint($"/swagger/v1/swagger.json", "Book Review Api"); }); app.UseMiddleware(typeof(ErrorHandlingMiddleware)); app.UseMvc(); AutoMapper.Mapper.Initialize(x => { //x.CreateMap<Author, AuthorDTO>().AfterMap((src, dest) => dest.SetBooks(src.Books)); x.CreateMap <Author, AuthorDTO>(); x.CreateMap <AuthorDTO, Author>(); x.CreateMap <Author, AuthorInsertDTO>(); x.CreateMap <AuthorInsertDTO, Author>(); x.CreateMap <Author, AuthorDetailDTO>(); //x.CreateMap<Publisher, PublisherDTO>().AfterMap((src, dest) => dest.SetBooks(src.Books)); x.CreateMap <Publisher, PublisherDTO>(); x.CreateMap <PublisherDTO, Publisher>(); x.CreateMap <Publisher, PublisherDetailDTO>(); x.CreateMap <PublisherInsertDTO, Publisher>(); x.CreateMap <Publisher, PublisherInsertDTO>(); //x.CreateMap<User, UserProfileDTO>().AfterMap((src, dest) => dest.SetReviews(src.Reviews)); x.CreateMap <User, UserProfileDTO>(); x.CreateMap <UserDTO, User>(); x.CreateMap <UserProfileDTO, User>(); x.CreateMap <User, UserProfileDetailDTO>(); //x.CreateMap<Book, BookDTO>().AfterMap((src, dest) => dest.SetReviews(src.Reviews)); x.CreateMap <Book, BookDTO>(); x.CreateMap <Book, BookDetailDTO>(); x.CreateMap <BookInsertDTO, Book>(); x.CreateMap <Book, BookInsertDTO>(); //x.CreateMap<Review, ReviewDTO>().AfterMap((src, dest) => dest.SetCreatedDate(src.CreatedDate)); x.CreateMap <Review, ReviewDTO>(); //x.CreateMap<Review, ReviewDetailDTO>().AfterMap((src, dest) => dest.SetCreatedDate(src.CreatedDate)); x.CreateMap <Review, ReviewDetailDTO>(); x.CreateMap <ReviewInsertDTO, Review>(); x.CreateMap <ReviewUpdateDTO, Review>(); x.CreateMap <Review, ReviewUpdateDTO>(); x.CreateMap <User, UserFollowerDTO>(); x.CreateMap <Author, AuthorFollowerDTO>(); }); }
public BookReviewsController(BookReviewContext reviewContext) { _context = reviewContext; }
public PublisherRepository(BookReviewContext ctx) : base(ctx) { }
public FollowerRepository(BookReviewContext ctx) : base(ctx) { }