public async Task <PlayerCharacter> AddPlayerCharacter(PlayerCharacter playerCharacter) { var result = await _dbContext.PlayerCharacters.AddAsync(playerCharacter); foreach (var attribute in playerCharacter.PlayerAttributes) { _dbContext.Entry(attribute.BaseAttribute).State = EntityState.Unchanged; } foreach (var ability in playerCharacter.PlayerAbilities) { _dbContext.Entry(ability.BaseAbility).State = EntityState.Unchanged; foreach (var skill in ability.SupportsPlayerSkills) { _dbContext.Entry(skill.BaseSkill).State = EntityState.Unchanged; } } foreach (var skill in playerCharacter.PlayerSkills) { _dbContext.Entry(skill.BaseSkill).State = EntityState.Unchanged; } foreach (var value in playerCharacter.TrainingValues) { _dbContext.Entry(value.BaseTrainingValue).State = EntityState.Unchanged; } await _dbContext.SaveChangesAsync(); return(result.Entity); }
public async Task <BaseTrainingValue> AddBaseTrainingValue(BaseTrainingValue baseTrainingValue) { var result = await _dbContext.BaseTrainingValues.AddAsync(baseTrainingValue); await _dbContext.SaveChangesAsync(); return(result.Entity); }
public async Task <BaseAttribute> AddBaseAttribute(BaseAttribute baseAttribute) { var result = await _dbContext.BaseAttributes.AddAsync(baseAttribute); await _dbContext.SaveChangesAsync(); return(result.Entity); }
public async Task <BaseSkill> AddBaseSkill(BaseSkill baseSkill) { var result = await _dbContext.BaseSkills.AddAsync(baseSkill); await _dbContext.SaveChangesAsync(); return(result.Entity); }
public async Task <PlayerSkill> AddPlayerSkill(PlayerSkill playerSkill) { var result = await _dbContext.PlayerSkills.AddAsync(playerSkill); _dbContext.Entry(playerSkill.BaseSkill).State = EntityState.Unchanged; await _dbContext.SaveChangesAsync(); return(result.Entity); }
public async Task <PlayerAttribute> AddPlayerAttribute(PlayerAttribute playerAttribute) { var result = await _dbContext.PlayerAttributes.AddAsync(playerAttribute); _dbContext.Entry(playerAttribute.BaseAttribute).State = EntityState.Unchanged; await _dbContext.SaveChangesAsync(); return(result.Entity); }
public async Task <BaseAbility> AddBaseAbility(BaseAbility baseAbility) { var result = await _dbContext.BaseAbilities.AddAsync(baseAbility); foreach (var value in baseAbility.ModifiesBaseTrainingValues) { _dbContext.Entry(value).State = EntityState.Unchanged; } _dbContext.Entry(baseAbility.ModifiesBaseTrainingValues).State = EntityState.Unchanged; await _dbContext.SaveChangesAsync(); return(result.Entity); }
public async Task <PlayerAbility> AddPlayerAbility(PlayerAbility playerAbility) { var result = await _dbContext.PlayerAbilities.AddAsync(playerAbility); foreach (var value in playerAbility.BaseAbility.ModifiesBaseTrainingValues) { _dbContext.Entry(value).State = EntityState.Unchanged; } foreach (var skill in playerAbility.SupportsPlayerSkills) { _dbContext.Entry(skill).State = EntityState.Unchanged; _dbContext.Entry(skill.BaseSkill).State = EntityState.Unchanged; } _dbContext.Entry(playerAbility.BaseAbility).State = EntityState.Unchanged; foreach (var attribute in playerAbility.BaseAbility.UsesBaseAttributes) { _dbContext.Entry(attribute).State = EntityState.Unchanged; } await _dbContext.SaveChangesAsync(); return(result.Entity); }