public static void InsertNewSkill(String name, String description, int level,Guid userId) { bindedinEntities bie = SingletonEntities.Instance; var existing = from c in bie.competences where c.description.Equals(description) where c.name.Equals(name) select c; if (existing.Count() == 0) { competence comp = new competence { name=name, description=description }; bie.competences.AddObject(comp); bie.SaveChanges(); } var idComp = from c in bie.competences where c.name.Equals(name) where c.description.Equals(description) select c.id; user_competence uc = new user_competence { user=userId, competence=idComp.First(), level=level, }; bie.user_competence.AddObject(uc); bie.SaveChanges(); }
/// <summary> /// Deprecated Method for adding a new object to the competences EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTocompetences(competence competence) { base.AddObject("competences", competence); }
/// <summary> /// Create a new competence object. /// </summary> /// <param name="id">Initial value of the id property.</param> /// <param name="name">Initial value of the name property.</param> /// <param name="description">Initial value of the description property.</param> public static competence Createcompetence(global::System.Int32 id, global::System.String name, global::System.String description) { competence competence = new competence(); competence.id = id; competence.name = name; competence.description = description; return competence; }