public async Task <IActionResult> DamageCharacter(string id, DamageCharacterRequest damageCharacterRequest) { return(await GeneralHitpointService( id, character => validateDamageCharacter(character, damageCharacterRequest), character => applyDamageToCharacter(character, damageCharacterRequest.DealtDamage) )); }
private ErrorInformation validateDamageCharacter(Character character, DamageCharacterRequest damageCharacterRequest) { if (character == null) { return(ErrorInformation.InvalidCharacterError()); } if (damageCharacterRequest.DealtDamage == null || damageCharacterRequest.DealtDamage.Count < 1) { return(ErrorInformation.InvalidParameterError()); } return(null); }