示例#1
0
        /// <summary>
        /// Create a new EmpAddress object.
        /// </summary>
        /// <param name="addressId">Initial value of the AddressId property.</param>
        public static EmpAddress CreateEmpAddress(global::System.Int32 addressId)
        {
            EmpAddress empAddress = new EmpAddress();

            empAddress.AddressId = addressId;
            return(empAddress);
        }
        /// <summary>
        /// Save the new employee's address information to the database.
        /// </summary>
        private void SaveEmpAddress()
        {
            int currentEmpId = (from a in Config.Context.Employees select a.EmpId).Max();

            var empAddress = new EmpAddress
            {
                AddressLine = tbxAddress.Text,
                City        = tbxCity.Text,
                State       = tbxState.Text,
                EmpId       = currentEmpId,
            };

            Config.Context.AddToEmpAddresses(empAddress);
            Config.Context.SaveChanges();
        }
示例#3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the EmpAddresses EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToEmpAddresses(EmpAddress empAddress)
 {
     base.AddObject("EmpAddresses", empAddress);
 }