Esempio n. 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);
        }
Esempio n. 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);
        }