示例#1
0
        public async Task <IActionResult> ModifyLevel(LevelModifyInputModel inputModel)
        {
            await this.userService.CheckIfUserExists(inputModel.Name);

            await this.levelService.UpdateLevel(inputModel);

            return(this.RedirectToAction("ModifyHero", new { inputModel.Name }));
        }
示例#2
0
        public async Task <IActionResult> ModifyLevel(string name)
        {
            await this.userService.CheckIfUserExists(name);

            LevelModifyInputModel inputModel = await this.heroService.GetHeroViewModelByName <LevelModifyInputModel>(name);

            return(this.View(inputModel));
        }
示例#3
0
        public async Task UpdateLevel(LevelModifyInputModel inputModel)
        {
            Hero hero = await this.heroService.GetHeroByName(inputModel.Name);

            DatabaseLevel databaseLevel = await this.context.DatabaseLevels.SingleAsync(l => l.Level == inputModel.LevelCurrentLevel);

            hero.Level.CurrentLevel      = databaseLevel.Level;
            hero.Level.NeededExperience  = databaseLevel.NeededExperience;
            hero.Level.CurrentExperience = 0;

            await this.context.SaveChangesAsync();
        }