public IActionResult Post([FromBody] AbilityVO item) { if (item == null) { return(BadRequest()); } var createdItem = _business.Create(item); if (createdItem == null) { return(BadRequest()); } return(new OkObjectResult(createdItem)); }
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); } } }