Exemple #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, GodsArenaApiContext godsArenaApiContext)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            godsArenaApiContext.EnsureSeedDataForContext();

            AutoMapper.Mapper.Initialize(cfg =>
            {
                //Player
                cfg.CreateMap <Models.PlayerForCreationDto, Entities.Player>();
                cfg.CreateMap <Entities.Player, Models.PlayerDto>();
                cfg.CreateMap <Models.PlayerDto, Entities.Player>();
                //Loot
                cfg.CreateMap <Entities.Loot, Models.LootDto>();
                cfg.CreateMap <Entities.Card, Models.CardDto>();
                cfg.CreateMap <Entities.GoldLoot, Models.GoldLootDto>();
                cfg.CreateMap <Models.LootDto, Models.LootPurchaseResultDto>()
                .Include <Models.CardDto, Models.CardPurchaseResultDto>()
                .Include <Models.GoldLootDto, Models.GoldPurchaseResultDto>();
                cfg.CreateMap <Models.GoldLootDto, Models.GoldPurchaseResultDto>();
                cfg.CreateMap <Models.CardDto, Models.CardPurchaseResultDto>();
                //PackContent
                cfg.CreateMap <Entities.PackContent, Models.PackContentDto>();
                cfg.CreateMap <Entities.PackContent, Models.PackContentWithoutCardDto>();
                //Deck
                cfg.CreateMap <Entities.Deck, Models.DeckDto>();
                cfg.CreateMap <Entities.Deck, Models.DeckWithoutCardInLevelSlotDto>();
                cfg.CreateMap <Models.DeckWithoutCardInLevelSlotDto, Entities.Deck>();
                //LevelSlot
                cfg.CreateMap <Entities.LevelSlot, Models.LevelSlotDto>();
                cfg.CreateMap <Entities.LevelSlot, Models.LevelSlotWithoutCardDto>();
                cfg.CreateMap <Models.LevelSlotWithoutCardDto, Entities.LevelSlot>();
                //Purchase
                cfg.CreateMap <Entities.Purchase, Models.PurchaseWithoutDeckAndPlayerDto>();
                //Chest
                cfg.CreateMap <Entities.Chest, Models.ChestDto>();
            });

            app.UseHttpsRedirection();
            app.UseMvc();
        }