private void btnSave_Click(object sender, EventArgs e) { if ((txtTitle.TextLength > 0) && (txtApiUrl.TextLength > 0)) { DBDataContext ctx = new DBDataContext(Properties.Settings.Default.ConnStr); if (editMode) { CategoryContent c = (from cat in ctx.CategoryContents where cat.Id.Equals(this.contentID) select cat).Single(); c.Title = txtTitle.Text; c.ApiUrl = txtApiUrl.Text; ctx.SubmitChanges(); } else { CategoryContent c = new CategoryContent { Title = txtTitle.Text, ApiUrl = txtApiUrl.Text, CatId = this.catID }; ctx.CategoryContents.InsertOnSubmit(c); ctx.SubmitChanges(); } this.Close(); } else { MessageBox.Show("You need to have both a title and a url."); } }
partial void DeleteCategoryContent(CategoryContent instance);
partial void UpdateCategoryContent(CategoryContent instance);
partial void InsertCategoryContent(CategoryContent instance);
private void detach_CategoryContents(CategoryContent entity) { this.SendPropertyChanging(); entity.Category = null; }
private void attach_CategoryContents(CategoryContent entity) { this.SendPropertyChanging(); entity.Category = this; }