public void AddSkillForAResource(Resource resource , Skill skill , int strength) { var skillAlreadyExisting = DocumentSession.Load<Skill>(skill.Id); if (skillAlreadyExisting == null) { DocumentSession.Store(skill); } if (isResourceAlreadyHaveTheSkill(resource, skill)) throw new ResourceAlreadyPossessingThisSkillException(); resource.AddSkill(skill , strength); DocumentSession.Store(resource); }
public void AddSkillForAResource(Resource resource, Skill skill, int strength) { var skillAlreadyExisting = DocumentSession.Load <Skill>(skill.Id); if (skillAlreadyExisting == null) { DocumentSession.Store(skill); } if (isResourceAlreadyHaveTheSkill(resource, skill)) { throw new ResourceAlreadyPossessingThisSkillException(); } resource.AddSkill(skill, strength); DocumentSession.Store(resource); }