コード例 #1
0
 public string UpdateSkill(SkillDetailsModel skill)
 {
     using (var dbContext = new SkillTrackerDBContext())
     {
         var sk = dbContext.SkillDetails.Where(a => a.Skill_Id.Equals(skill.SkillId)).SingleOrDefault();
         sk.Skill_Name = skill.SkillName;
         dbContext.SaveChanges();
         return("Skill Successfully Updated");
     }
 }
コード例 #2
0
 public string AddSkill(SkillDetailsModel skill)
 {
     using (var dbContext = new SkillTrackerDBContext())
     {
         var addskill = new skill_details()
         {
             Skill_Id = skill.SkillId, Skill_Name = skill.SkillName
         };
         dbContext.SkillDetails.Add(addskill);
         dbContext.SaveChanges();
         return("Skill Successfully Inserted");
     }
 }
コード例 #3
0
 public string DeleteSkill(SkillDetailsModel skill)
 {
     using (var dbContext = new SkillTrackerDBContext())
     {
         var skilldet = dbContext.SkillDetails.Where(a => a.Skill_Id.Equals(skill.SkillId))
                        .SingleOrDefault();
         var associateskills = dbContext.AssociateSkill.Where(i => i.Skill_Id == skill.SkillId).ToList();
         foreach (var it in associateskills)
         {
             var associate = dbContext.AssociateSkill.Where(i => i.Associate_SkillID == it.Associate_SkillID);
             dbContext.AssociateSkill.Remove(it);
         }
         dbContext.SkillDetails.Remove(skilldet);
         dbContext.SaveChanges();
         return("Skill Details Successfully deleted");
     }
 }