Example #1
0
        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 user_competence EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTouser_competence(user_competence user_competence)
 {
     base.AddObject("user_competence", user_competence);
 }
 /// <summary>
 /// Create a new user_competence object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="user">Initial value of the user property.</param>
 /// <param name="competence">Initial value of the competence property.</param>
 /// <param name="level">Initial value of the level property.</param>
 public static user_competence Createuser_competence(global::System.Int32 id, global::System.Guid user, global::System.Int32 competence, global::System.Int32 level)
 {
     user_competence user_competence = new user_competence();
     user_competence.id = id;
     user_competence.user = user;
     user_competence.competence = competence;
     user_competence.level = level;
     return user_competence;
 }