/// <summary>
        /// Create a new sportfacility object.
        /// </summary>
        /// <param name="equipmentname">Initial value of the equipmentname property.</param>
        /// <param name="equipmentid">Initial value of the equipmentid property.</param>
        /// <param name="facilityavailable">Initial value of the facilityavailable property.</param>
        public static sportfacility Createsportfacility(global::System.String equipmentname, global::System.Int32 equipmentid, global::System.Int16 facilityavailable)
        {
            sportfacility sportfacility = new sportfacility();

            sportfacility.equipmentname     = equipmentname;
            sportfacility.equipmentid       = equipmentid;
            sportfacility.facilityavailable = facilityavailable;
            return(sportfacility);
        }
예제 #2
0
 public List <sportfacility> addsportfacility(string sportname, int number, string remarks)
 {
     using (modelEntities2 context = new modelEntities2())
     {
         sportfacility sf = new sportfacility();
         sf.equipmentname     = sportname;
         sf.facilityavailable = (Int16)number;
         sf.remarks           = remarks;
         context.AddTosportfacilities(sf);
         context.SaveChanges();
         return(context.sportfacilities.ToList());
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            // Loads to the txt box
            Int32 a = Convert.ToInt32(textBox1.Text);

            var q = (from x in context.sportfacilities
                     where x.equipmentid == (a)
                     select x);

            sp            = q.First <sportfacility>();
            textBox2.Text = sp.equipmentname;
            textBox3.Text = sp.facilityavailable.ToString();
            textBox4.Text = sp.remarks;
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the sportfacilities EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTosportfacilities(sportfacility sportfacility)
 {
     base.AddObject("sportfacilities", sportfacility);
 }