private void btnAdd_Click(object sender, RoutedEventArgs e) { PremiumRate premium = new PremiumRate(); premium.Rate = txtPremiumRate.Text; premium.Description = txtDescription.Text; premium.Commodity = (Commodity)txtCommodity.SelectedItem; premium.Country = (Country)txtCountry.SelectedItem; model.PremiumRates.AddObject(premium); model.SaveChanges(); }
/// <summary> /// Deprecated Method for adding a new object to the PremiumRates EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPremiumRates(PremiumRate premiumRate) { base.AddObject("PremiumRates", premiumRate); }
/// <summary> /// Create a new PremiumRate object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="rate">Initial value of the Rate property.</param> /// <param name="description">Initial value of the Description property.</param> /// <param name="countryId">Initial value of the CountryId property.</param> /// <param name="commodityId">Initial value of the CommodityId property.</param> public static PremiumRate CreatePremiumRate(global::System.Int32 id, global::System.String rate, global::System.String description, global::System.Int32 countryId, global::System.Int32 commodityId) { PremiumRate premiumRate = new PremiumRate(); premiumRate.Id = id; premiumRate.Rate = rate; premiumRate.Description = description; premiumRate.CountryId = countryId; premiumRate.CommodityId = commodityId; return premiumRate; }