예제 #1
0
        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);
        }
예제 #2
0
        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);
        }