コード例 #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env,
                              KbvbContext kbvbContext)
        {
            if (env.IsDevelopment())
            {
                KbvbContextExtensions.EnsureSeeded(kbvbContext);
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler();
            }

            AutoMapper.Mapper.Initialize(cfg =>
            {
                cfg.CreateMap <Player, PlayerDto>();
                cfg.CreateMap <User, UserDto>();
                cfg.CreateMap <User, UserForCreationDto>()
                .ForMember(dest => dest.FirstName, opt => opt.MapFrom(src => src.FirstName))
                .ForMember(dest => dest.LastName, opt => opt.MapFrom(src => src.LastName));
            });

            app.UseMvc();
        }
コード例 #2
0
 public UserRepository(KbvbContext context)
 {
     _context = context;
 }
コード例 #3
0
 public PlayerRepository(KbvbContext context)
 {
     _context = context;
 }