Ejemplo n.º 1
0
        public int SaveSkill(Database.Skill skill)
        {
            try
            {
                using (var db = new DatabaseContainer())
                {
                    db.Entry(skill).State = skill.Id == 0 ? System.Data.Entity.EntityState.Added : System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                }
            }
            catch (Exception e)
            {
            }

            return(skill.Id);
        }
Ejemplo n.º 2
0
 public void DeleteSkill(Database.Skill skill)
 {
     try
     {
         using (var db = new DatabaseContainer())
         {
             if (db.SkillsEvaluations.Where(x => x.SkillId == skill.Id).Count() == 0)
             {
                 db.Entry(skill).State = System.Data.Entity.EntityState.Deleted;
                 db.SaveChanges();
             }
         }
     }
     catch (Exception e)
     {
     }
 }