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 })); }
public async Task <IActionResult> ModifyLevel(string name) { await this.userService.CheckIfUserExists(name); LevelModifyInputModel inputModel = await this.heroService.GetHeroViewModelByName <LevelModifyInputModel>(name); return(this.View(inputModel)); }
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(); }