public static void Add(IContext context, IUserSkill user_skill) { Context ctx = context as Context; if (ctx == null) throw new Exception(typeof(Context).FullName + " expected."); SqlCommand command = new SqlCommand("insert into User_Skill (id_skill, id_user, level) values (@SkillID, @UserID, @Level)"); command.Parameters.Add(new SqlParameter("SkillID", user_skill.SkillID)); command.Parameters.Add(new SqlParameter("UserID", user_skill.UserID)); command.Parameters.Add(new SqlParameter("Level", user_skill.Level)); command.ExecuteNonQuery(); }
public static void Update(IContext context, IUserSkill user_skill) { Context ctx = context as Context; if (ctx == null) throw new Exception(typeof(Context).FullName + " expected."); SqlCommand command = new SqlCommand("update User_Skill set id_skill=@SkillID, id_user=@UserID, level=@Level where id_user_skill = @UserSkillID"); command.Parameters.Add(new SqlParameter("UserSkillID", user_skill.UserSkillID)); command.Parameters.Add(new SqlParameter("SkillID", user_skill.SkillID)); command.Parameters.Add(new SqlParameter("UserID", user_skill.UserID)); command.Parameters.Add(new SqlParameter("Level", user_skill.Level)); command.ExecuteNonQuery(); }