public AbilityVO FindOrCreate(AbilityVO item) { var ent = _converter.Parse(item); ent = _repository.FindOrCreate(ent); return(_converter.Parse(ent)); }
public AbilityVO Update(AbilityVO item) { var ent = _converter.Parse(item); ent = _repository.Update(ent); return(_converter.Parse(ent)); }
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)); }
public IActionResult Put([FromBody] AbilityVO item) { if (item == null) { return(BadRequest()); } var updatedItem = _business.Update(item); if (updatedItem == null) { return(NoContent()); } return(new OkObjectResult(updatedItem)); }
public AbilityVO Create(AbilityVO item) { var ent = _converter.Parse(item); try { ent = _repository.CreateAbility(ent); } catch (Exception ex) { throw ex; } return(_converter.Parse(ent)); }
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); } } }