Ejemplo n.º 1
0
        public IActionResult GetByExactName(string name, int type = (int)enAbility.all)
        {
            var ret = _business.FindByExactName(name, (enAbility)type);

            if (ret == null)
            {
                return(NotFound());
            }
            return(Ok(ret));
        }
Ejemplo n.º 2
0
        private void CreateHeroeAbilities(List <string> list, ref HeroeVO createdItem, int type)
        {
            HeroeAbility h = new HeroeAbility {
                idObjectA = createdItem.Id ?? default(long)
            };

            var errou = false;

            foreach (string s in list)
            {
                if (string.IsNullOrEmpty(s))
                {
                    continue;
                }

                AbilityVO vo = new AbilityVO {
                    Name = s.ToLower(), Type = type
                };
                try
                {
                    var ret = _ability.FindByExactName(vo.Name, (enAbility)vo.Type);

                    if (ret.Id == null)
                    {
                        ret = _ability.Create(vo);
                    }

                    h.idObjectB = ret.Id ?? default(long);
                    _heroeAbility.Create(h);
                }
                catch
                {
                    if (!errou)
                    {
                        _logger.Information("> " + createdItem.Name + " - Ability " + type.ToString());
                        errou = true;
                    }
                    _logger.Error(s);
                }
            }
        }