Ejemplo n.º 1
0
        public async Task <IActionResult> Add(AddSkillInputModel model)
        {
            var heroInfoId = HeroId;

            await this.skillsService.AddSkillAsync(model, heroInfoId);

            return(this.Redirect("/Heroes/All"));
        }
Ejemplo n.º 2
0
        public async Task AddSkillAsync(AddSkillInputModel model, int heroId)
        {
            var skill = new Skill
            {
                Name                = model.Name,
                Image               = model.Image,
                Description         = model.Description,
                Ability             = model.Ability,
                DamageType          = model.DamageType,
                PierceSpellImmunity = model.PierceSpellImmunity,
                Affects             = model.Affects,
                Cooldown            = model.Cooldown,
                ManaCost            = model.ManaCost,
                HeroInfoId          = heroId,
            };
            var id = heroId;

            await this.skillsRepository.AddAsync(skill);

            await this.skillsRepository.SaveChangesAsync();
        }