Ejemplo n.º 1
0
        public Skill DeleteSkill(Skill skill)
        {
            if (skill == null || skill.id <= 0)
                return null;

            return DeleteSkill(skill.id);
        }
        public Skill DeleteSkill(Skill obj)
        {
            if (obj == null || obj.id <= 0)
                return null;

            return repository.DeleteSkill(obj);
        }
 public Skill CreateSkill(Skill skill)
 {
     skill.id = 0;
     skills.Add(skill);
     skill.id = (skills.Max(s => s.id));
     skill.id++;
     return GetSkill(skill.id);
 }
Ejemplo n.º 4
0
        public Skill CreateSkill(Skill skill)
        {
            using (var ctx = new TarikSkillsDB())
            {
                ctx.Skills.Add(skill);
                ctx.SaveChanges();
                int newId = skill.id;

                return GetSkill(newId, ctx);
            }
        }
        public Skill UpdateSkill(Skill skill)
        {
            if (skill == null) return null;
            Skill s = GetSkill(skill.id);
            if (s == null) return null;

            s.experience = skill.experience;
            s.level_id = skill.level_id;
            s.name = skill.name;
            s.Level = GetLevel(skill.level_id);
            return s;
        }
Ejemplo n.º 6
0
        public Skill UpdateSkill(Skill skill)
        {
            using (var ctx = new TarikSkillsDB())
            {
                Skill s = GetSkill(skill.id, ctx);
                if (s == null) return null;

                s.level_id = skill.level_id;
                s.name = skill.name;
                s.experience = skill.experience;
                ctx.SaveChanges();
                s.Level = GetLevel(s.level_id);
                return s;
            }
        }
 public Skill EditSkill(Skill obj)
 {
     return repository.UpdateSkill(obj);
 }
 public Skill CreateSkill(Skill obj)
 {
     return repository.CreateSkill(obj);
 }