AddToDialPlanData() public method

Deprecated Method for adding a new object to the DialPlanData EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead.
public AddToDialPlanData ( DialPlanDataEntry dialPlanDataEntry ) : void
dialPlanDataEntry DialPlanDataEntry
return void
Esempio n. 1
0
        public void DBWrite(string authUsername, string key, string value)
        {
            using (var entities = new SIPSorceryEntities())
            {
                var existingEntry = entities.DialPlanData.Where(x => x.DataOwner == authUsername && x.DataKey == key).SingleOrDefault();

                if (existingEntry != null)
                {
                    existingEntry.DataValue = value;
                }
                else
                {
                    var newEntry = new DialPlanDataEntry() { DataOwner = authUsername, DataKey = key, DataValue = value };
                    entities.AddToDialPlanData(newEntry);
                }

                entities.SaveChanges();
            }
        }