public void Save() { var dc = new RobotBehaviorsDataContext(SqlConnectionString); if (this.Id == 0) { var robotBehaviorKeyphrase = new RobotBehaviorKeyphrase(); robotBehaviorKeyphrase.SynAppsId = this.SynAppsId; robotBehaviorKeyphrase.SynAppsDeviceId = this.SynAppsDeviceId; robotBehaviorKeyphrase.Keyphrase = this.Keyphrase; robotBehaviorKeyphrase.KeyphraseReply = this.KeyphraseReply; robotBehaviorKeyphrase.Status = this.Status; robotBehaviorKeyphrase.IsSynAppsLinked = this.IsSynAppsLinked; robotBehaviorKeyphrase.IsDeleted = this.IsDeleted; robotBehaviorKeyphrase.CreatedAt = DateTime.Now; dc.RobotBehaviorKeyphrases.InsertOnSubmit(robotBehaviorKeyphrase); dc.SubmitChanges(); this.Id = robotBehaviorKeyphrase.Id; this.CreatedAt = robotBehaviorKeyphrase.CreatedAt; } else { var records = from n in dc.RobotBehaviorKeyphrases where n.Id == this.Id select n; foreach (var r in records) { r.SynAppsId = this.SynAppsId; r.SynAppsDeviceId = this.SynAppsDeviceId; r.Keyphrase = this.Keyphrase; r.KeyphraseReply = this.KeyphraseReply; r.Status = this.Status; r.IsSynAppsLinked = this.IsSynAppsLinked; r.IsDeleted = this.IsDeleted; r.UpdatedAt = DateTime.Now; } dc.SubmitChanges(); } }
partial void DeleteRobotBehaviorKeyphrase(RobotBehaviorKeyphrase instance);
partial void UpdateRobotBehaviorKeyphrase(RobotBehaviorKeyphrase instance);
partial void InsertRobotBehaviorKeyphrase(RobotBehaviorKeyphrase instance);