partial void DeletePredictionIntent(PredictionIntent instance);
partial void InsertPredictionIntent(PredictionIntent instance);
partial void UpdatePredictionIntent(PredictionIntent instance);
public ApiResult Save() { var apiResult = new ApiResult() { StatusCode = StatusCode.Success }; var now = DateTime.UtcNow; var dc = new PredictionExamplesDataContext(SqlConnectionString); if (this.Id == 0) { var r = new PredictionIntent(); r.SynAppsDeviceId = this.SynAppsDeviceId; r.LuisExampleId = this.LuisExampleId; r.Intent = this.Intent; r.CreatedAt = now; r.UpdatedAt = now; try { dc.PredictionIntents.InsertOnSubmit(r); dc.SubmitChanges(); this.Id = r.Id; this.CreatedAt = r.CreatedAt; this.UpdatedAt = r.UpdatedAt; } catch (Exception e) { apiResult.StatusCode = StatusCode.Error; apiResult.Message = e.Message; } } else { var records = from n in dc.PredictionIntents where n.Id == this.Id select n; foreach (var r in records) { r.SynAppsDeviceId = this.SynAppsDeviceId; r.LuisExampleId = this.LuisExampleId; r.Intent = this.Intent; r.UpdatedAt = now; } try { dc.SubmitChanges(); } catch (Exception e) { apiResult.StatusCode = StatusCode.Error; apiResult.Message = e.Message; } } return(apiResult); }