Ejemplo n.º 1
0
        public static int InsertSchool(String name, String description)
        {
            bindedinEntities bie = SingletonEntities.Instance;
             var existingSchool = from s in bie.schools
                                  where s.name.Equals(name)
                                  where s.description.Equals(description)
                                  select s;

             if (existingSchool.Count() == 0)
             {

                 school sc = new school
                 {
                     name = name,
                     description = description
                 };

                 bie.AddToschools(sc);
                 bie.SaveChanges();

             }
            var id = from s in bie.schools
                     where s.name.Equals(name)
                     where s.description.Equals(description)
                     select s.id;
            return id.First();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the schools EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToschools(school school)
 {
     base.AddObject("schools", school);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Create a new school 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 school Createschool(global::System.Int32 id, global::System.String name, global::System.String description)
 {
     school school = new school();
     school.id = id;
     school.name = name;
     school.description = description;
     return school;
 }