public IActionResult Post([FromBody] HeroeAbility item)
 {
     if (item == null)
     {
         return(BadRequest());
     }
     return(new  ObjectResult(_business.Create(item)));
 }
Esempio 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);
                }
            }
        }
Esempio n. 3
0
 public HeroeAbility Create(HeroeAbility mccHeroeAbility)
 {
     return(_repository.Create(mccHeroeAbility));
 }