Esempio n. 1
0
        public IActionResult Get(int id)
        {
            Hero hero = new Hero {
                ID = id
            };

            try
            {
                hero = _heroService.LoadHero(id);
            }
            catch (Exception)
            {
                // No such hero (non-existing ID).
                // HTTP status code: 404 (Not Found)
                return(NotFound(new { id = hero.ID }));
            }
            // HTTP status code: 200 (OK)
            return(Ok(hero));
            // return hero;
        }
Esempio n. 2
0
    public void OnClickSelectOption(string option)
    {
        Toggle();

        var heroName = Heroes[CurrentHeroIndex];
        var hero     = HeroService.LoadHero(heroName);

        var skillName = ArrangedSkillKnowledges[SelectedSkillIndex].name;

        try
        {
            SkillService.AddSkill(hero, skillName, option);
        }
        catch (BusinessException.BusinessException e)
        {
            AddSkillError.transform.localScale = new Vector3(1, 1, 1);
            ErrorMessage      = GameObject.FindGameObjectWithTag("ErrorMessage").GetComponent <Text>();
            ErrorMessage.text = e.Message;
        }
    }