public async Task <IActionResult> ModifyHealth(string name) { await this.userService.CheckIfUserExists(name); HealthModifyInputModel inputModel = await this.heroService.GetHeroViewModelByName <HealthModifyInputModel>(name); return(this.View(inputModel)); }
public async Task <IActionResult> ModifyHealth(HealthModifyInputModel inputModel) { await this.userService.CheckIfUserExists(inputModel.Name); await this.healthService.UpdateHealth(inputModel); return(this.RedirectToAction("ModifyHero", new { inputModel.Name })); }
public async Task UpdateHealth(HealthModifyInputModel inputModel) { Hero hero = await this.heroService.GetHeroByName(inputModel.Name); hero.Health.Current = inputModel.HealthCurrent; hero.Health.Maximum = inputModel.HealthMaximum; await this.context.SaveChangesAsync(); }